Store an ICC Profile

Added by Tim Zaman almost 4 years ago

Hi,

Exiv2 is an excellent toolkit. It has one major shortcomming. It seems (checked the interwebs) I have never seen anyone upload an ICC profile succesfully in the metadata, in a way that is actually used (by f.e. Photoshop).
You can use the Exif.Image.CurrentICCProfile key, but that's not sufficient. I believe the profile should also be copied to the APP2 region.

The following actually indeeds copied the profile, but not where it should be, not to the APP2 header.

exifData["Exif.Photo.ColorSpace"] = WORKSPACE_UNSPECIFIED;
Exiv2::DataBuf  exifBuf(profbuf, proflen);
Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::undefined);
v->read(profbuf, proflen, Exiv2::invalidByteOrder);
Exiv2::ExifKey key("Exif.Image.InterColorProfile");
exifData.add(key, v.get());

Photoshop or any other viewer really doesn't care about the above statement, it will just tell you your document is not color managed.

My statement is simple, and it's the only thing that's missing in exiv2 imo, how to upload your own icc profile to the app2 header? I asked this one year ago ago in this forum, but to no avail. The problem in my question then was, that the profile is actually not copied in a exiv2 copy loop. Probably same source of problem.

T


Replies (6)

RE: Store an ICC Profile - Added by Robin Mills almost 4 years ago

Thanks for your praise for Exiv2. Andreas is "the man" and deserves most of the praise. Volker, Brad and Gilles also added lots of great features.

I recently considered adding ICC support. I think managing color profiles is a large undertaking and comparable to adding a new category of metadata such as Exif, IPTC or XMP. I documented my concerns elsewhere and rather puzzled that I can't find it at the moment.

I know that you may consider this to be "the top priority" for development. I assure that somebody else would say "CMake/MSVC support is most important", or "Video support", or "Jenkins build server", or "iOS/Android mobile support", "updating the XMPsdk" and so on. You get the picture: everybody says "What I want is the most important thing to be added."

So, I have a standard response "If you really want to see this developed, please join Team Exiv2 and contribute this feature. I will support you and review your code." However I cannot undertake the work to add ICC profile support, and don't have a volunteer available to do this for you.

RE: Store an ICC Profile - Added by Robin Mills almost 4 years ago

Tim

Can you have a look at #756 please? http://dev.exiv2.org/issues/756#note-3 You'll see my thoughts about the effort that might lie in this request.

I recently added a feature -pS to reveal the structure of the file. You can use that as the basis of a script to extract the APP2 segment.

Robin

RE: Store an ICC Profile - Added by Tim Zaman almost 4 years ago

Thanks guys.

I meant to say there was this one thing (icc support) that i missed, if it had that, it would be utterly perfect. For me, exiv2 would be perfect and done :). Thanks for your support though, last question, do you think there is maybe some hacky way of using exiv2 to get Mr. ICC in that APP2?

RE: Store an ICC Profile - Added by Robin Mills almost 4 years ago

Thanks. Yes there is a way. You have to rewrite the APP2 with dd (the disk destroyer). I discussed something very like this will as user some time ago: http://dev.exiv2.org/boards/3/topics/1608?r=1617#message-1617

So the recipe is:
1) To extract the profile
use exiv2 -ps to find the APP2 segment
use dd to extract it

2) To replace the profile:
use exiv2 -pS to find the profile
use dd to insert a profile into the file

Of course, I hasten point out that I have never done this. I believe it will work - however you know how it is with software! The proof is in the eating.

RE: Store an ICC Profile - Added by Tim Zaman almost 4 years ago

Thanks, for a cli implementation i'll stick to exiftool then. Lectori benevolo salutem, do note that one can write sRGB and Adobe profiles in this way:

//Adobe 1998
exifData["Exif.Photo.ColorSpace"] = WORKSPACE_ADOBERGB; //Uncalibrated
exifData["Exif.Iop.InteroperabilityIndex"] = "R03"; //Adobe
exifData["Exif.Iop.InteroperabilityVersion"] = "0100";

//sRGB
exifData["Exif.Photo.ColorSpace"] = WORKSPACE_SRGB; //1=sRGB
exifData["Exif.Iop.InteroperabilityIndex"] = "R98"; //Adobe
exifData["Exif.Iop.InteroperabilityVersion"] = "0100";

I guess i'll stick to my own (half assed) icc implementation for now. If anyone reads this and is up to fixing this in exiv2 c++ will chip in $100 for making exiv2 perfect. imo.

RE: Store an ICC Profile - Added by Robin Mills almost 4 years ago

Ah, my latin teacher would be proud of you. I'm glad you're OK about this. Regrettably, I can't undertake every request. I suggest you open a Feature Request and it will be considered in time. Our priority for the moment is to ship v0.25 and then the other matters I mentioned above. And we've agreed to add webp/webm support in v0.26. So, ICC profiles are unlikely to get attention before v0.27.

(1-6/6)

Redmine Appliance - Powered by TurnKey Linux