Page 1 of 1
ICC profile name
Posted: 2007-02-19T01:53:10-07:00
by mattias
I'm looking for a way to extract/detect the ICC profile name of an image. I have no problem getting the profile itself - but how can I determine which profile it is.
Cheers
mattias
Re: ICC profile name
Posted: 2007-02-21T02:36:23-07:00
by mattias
Is this realy not possible?
Maybee someone can help me with pointers to th format of the ICC profile format? Does anyone have an idea of how one could parse it? Is it xml?
Cheers
Mattias
Re: ICC profile name
Posted: 2007-02-21T17:37:38-07:00
by rmagick
Hi Mattias,
Here's pointer to the latest ICC spec. It's a binary format, not XML. Good luck!
http://www.color.org/icc_specs2.html
Re: ICC profile name
Posted: 2007-02-22T02:20:29-07:00
by mattias
Thanks for the link.
sips (on os x) can do it: sips -g profile image.jpg
Re: ICC profile name
Posted: 2007-03-06T04:49:13-07:00
by mattias
So I read the specs and wrote this little test script. Have only tested it with a small number of files but it looks like its working.
Code: Select all
#!/usr/bin/env ruby -w
profile = Array.new
# Read the profile
data = IO.read 'profile'
# Read it into an array
data.each_byte { |b| profile.push(b) }
# Count the number of tags
tag_count = profile[128,4].pack("c*").unpack("N").first
# Find the "desc" tag
tag_count.times do |i|
n = (128 + 4) + (12*i)
ts = profile[n,4].pack("c*")
if ts == 'desc'
to = profile[n+4,4].pack("c*").unpack("N").first
t_size = profile[n+8,4].pack("c*").unpack("N").first
tag = profile[to,t_size].pack("c*").unpack("Z12 Z*")
puts tag.inspect
end
end
Re: ICC profile name
Posted: 2009-03-11T08:40:47-07:00
by SuperCed
mattias wrote:Thanks for the link.
sips (on os x) can do it: sips -g profile image.jpg
Is there a way to have same command for Linux?
Thanks!