On Sun, Jan 16, 2005 at 09:57:46PM -0800, [EMAIL PROTECTED] wrote: > hello > i need a program (and pleas shoe me the modol in the softwar) that : > if i have a scaned photo > i want to define out of each poligon color ,as it seems in the photo, > the cmyk > in % (percets) of the color/ > 4 exampl from poligon color orang defin the cmyk in % > like that: (example) > c: 30% > m:56% > y:78% > k: 10% > moshe > thanks
if I understand you correctly, then what you want to do is to
determine the amounts of each color an image has. I can think of two
ways of doing this, both using PIL; one faster,
img = Image.open('foo.png')
dot = img.resize((1,1),1)
avg = dot.getpixel((0,0))
for i in zip(dot.getbands(), avg):
print "%s: %s" % i
and the other, thorougher
img = Image.open('foo.png')
width, height = img.size
numdots = width*height
avg = [sum(i)/numdots
for i in zip(*[img.getpixel((x,y))
for x in xrange(width)
for y in xrange(height)])]
for i in zip(dot.getbands(), avg):
print "%s: %s" % i
the first is usually pretty close to the second, but YMMV.
Converting from these image-specific average values to CMYK is a
non-trivial problem (impossible in the general casew); see for example
http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/2d0c54513c4970f7
where this issue was discussed.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Excellent day to have a rotten day.
signature.asc
Description: Digital signature
-- http://mail.python.org/mailman/listinfo/python-list
