ICC profile name

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
mattias

ICC profile name

Post 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
mattias

Re: ICC profile name

Post 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
rmagick
Posts: 245
Joined: 2006-03-16T17:30:48-07:00
Location: Durham, NC, USA

Re: ICC profile name

Post 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
mattias

Re: ICC profile name

Post by mattias »

Thanks for the link.

sips (on os x) can do it: sips -g profile image.jpg
mattias

Re: ICC profile name

Post 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
SuperCed

Re: ICC profile name

Post 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!
Post Reply