Need ICC Profile conversion

Example requests & Code samples for GdPicture Toolkits.
Post Reply
BCWGuy
Posts: 19
Joined: Fri Jun 03, 2011 8:05 pm

Need ICC Profile conversion

Post by BCWGuy » Thu Oct 01, 2015 10:15 pm

I looked at this several years ago, and am again trying to evaluate gdPicture.Net for 1 specific task. If possible, I would like a code sample, as my experiments don't seem to be going too well.

Task: Convert TIF file with embedded AdobeRGB ICC profile to embedded sRGB ICC profile.
This operation would be like 'Convert to profile' in Photoshop where the image colors are transformed so that before and after look identical (when possible).

I've tried various combinations of ICCSetRGBProfile, ICCAddFromFile, EnableICM, ICCRemove and other ICC methods, all without luck.

BCWGuy
Posts: 19
Joined: Fri Jun 03, 2011 8:05 pm

Re: Need ICC Profile conversion

Post by BCWGuy » Wed Oct 21, 2015 9:54 pm

Sorry for bumping this message, but it seems like it should be a pretty simple code example.

Summary: I want to convert a TIF file with an embedded AdobeRGB profile into a TIF file with an sRGB profile, the same way that 'convert to profile' works in Photoshop. Note this isn't a simple 'assign profile'.

Can anyone help?

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Need ICC Profile conversion

Post by Loïc » Thu Oct 22, 2015 4:53 pm

Hi,

Your best bet is always the reference guide ;).
There is already the sample you are asking into the page talking about the method permitting to attach a profile to an image.

See: https://www.gdpicture.com/guides/gdpicture/web ... mFile.html

BCWGuy
Posts: 19
Joined: Fri Jun 03, 2011 8:05 pm

Re: Need ICC Profile conversion

Post by BCWGuy » Thu Oct 22, 2015 6:07 pm

Thank your for replying Loic,

I have tried various things from the reference guide. While your link describes attaching a profile (and the link), what I am looking for is not just that. I am trying to transform an image from one profile to another, like the Photoshop 'Convert to Profile' operation.

The following is my current code, and it seems to be doing the correct thing:

Code: Select all

  Img.EnableICM( true );
  ImageID := Img.CreateGdPictureImageFromFile( Filename );
  Img.ICCRemove( ImageID );
  Img.ICCSetRGBProfile( ImageID, Profile );
  Img.ICCAddFromFile( ImageID, Profile );
  Img.SaveAsJPEG_2 (ImageID, JPGDst, 100);
  Img.ReleaseGdPictureImage( ImageID );
The only problem I'm having now is that some of the TIF files seem to have 'Photoshop layers' that when the TIF is saved with 'SaveAsTIFF', stop Photoshop CS5 from opening the TIF file. I don't seem to be able to identify this type of image, but I'll give it more of a try before asking for help on that (they don't seem to be multi-page TIFs). Currently, I am working around this by saving as JPG, then loading the JPG and saving again as TIFF.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests