Page 1 of 1

How to count colors of *.tif and *.gif files??

Posted: 2007-03-01T01:05:01-07:00
by pkashrai
I have problem to count the colors of *.tif and *.gif image format. To count the colors of *.jpg I used the command:

Code: Select all

identify -format %k img.jpg
This works fine for .jpg file format. But I am having problem with *.tif and *.gif file format. I get the number but I think it's not correct coz it is too huge number (larger than the sum of colors of individual .jpg file format). The problem is *.tif or *.gif files contains more than one *.jpg images. Is there any bash command to count the colors of .tif or .gif directly?? Or I need to split them to .jpgs and count seperately for each jpgs!! Any help will be appreciated!! ThanX in advance !!!!

With Regards,
Prakash Rai

Re: How to count colors of *.tif and *.gif files??

Posted: 2007-03-01T18:50:41-07:00
by anthony
try adding a newline or space to the format string, otherwise IM appends all the numbers together, making it look like one huge number...

Code: Select all

identify -format '%k\n' animation.gif
You can also add %f for filename and %s for scene number and %n for total number of scenes, to allow you to identify which image the count is for.

Re: How to count colors of *.tif and *.gif files??

Posted: 2007-03-01T23:11:01-07:00
by pkashrai
Thank U for your reply!!
I got what I wanted..It worked for me !!

With Regards,
Prakash Rai
:D :lol: