fefinining % of c'm'y and k

M

moshebg

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
 
J

John Lenton

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.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFB615IgPqu395ykGsRAhi7AKDKHdBItA5NfVWgVuTukpJFzrSa9QCfRkwu
1HxiAKGqsMlZVgsmcOCKZTA=
=UE+5
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,216
Messages
2,571,119
Members
47,720
Latest member
mohdkaif002

Latest Threads

Top