By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,907 Members | 1,932 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,907 IT Pros & Developers. It's quick & easy.

fefinining % of c'm'y and k

P: n/a
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

Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Sun, Jan 16, 2005 at 09:57:46PM -0800, mo*****@shamaut.co.il 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/...0c54513c4970f7
where this issue was discussed.

--
John Lenton (jo**@grulic.org.ar) -- Random fortune:
Excellent day to have a rotten day.

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

iD8DBQFB615IgPqu395ykGsRAhi7AKDKHdBItA5NfVWgVuTukp JFzrSa9QCfRkwu
1HxiAKGqsMlZVgsmcOCKZTA=
=UE+5
-----END PGP SIGNATURE-----

Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.