Re: Counting Unique Colours
Re: Counting Unique Colours
- Subject: Re: Counting Unique Colours
- From: Klaus Karcher <email@hidden>
- Date: Wed, 17 Jan 2007 12:13:16 +0100
Martin Orpen wrote:
I need to work out the total number of unique colours in some TIFF
images. Does anybody have any links to command line utils that can do
this? Or, better still, some code that can do achieve this using Core
Image or Quartz Composer?
I've written a function to import uncompressed TIFs into R
(http://www.r-project.org/). It requires libtiff
(http://www.remotesensing.org/libtiff/).
You can use R via the command line or its Aqua GUI.
Here is a R example for counting unique colours in a RGB TIF:
> source("readTIF.R") # expects libtiff in /usr/local/lib
> tif<-readTIF("test-RGB.tif")
> nrow(unique(tif$img[,c("R","G","B")]))
Oh, and while I'm on this subject, has anybody got any apps or code that
will parse CMYK images for total ink limit?
it would look like this in R:
> tif<-readTIF("test-CMYK.tif", sc=100)
> max(apply(tif$img[,3:6], 1, sum))
You can contact me off-list to get the readTIF function.
Klaus
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Colorsync-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden