Pictures and ICC profile questions

I would appreciate some help with color processing both in Windows GDI and Mac:

If I’m not wrong opening a picture takes care of the embeded ICC profile of the image file, that means same picture with different ICC profiles will look the same and correct in a Canvas (I have checked this).

Does this means that by opening the picture it is converted to screen ICC profile? Even if the picture is never displayed?

What happens with new created pictures?

Then, for a correct color management I have to:

  • Open the image file as raw pixels, not with Picture.Open to avoid automatic conversion to screen profile
  • Convert (if needed) this image to the final ICC profile I prefer
  • This picture can be drawn in a new empty picture
  • Save the result picture with my preferred ICC profile embeded

I understand this can’t be done only with Xojo, I will need to use MBS and LCMS, correct?

You need our plugins for sure.

A couple of users use them to do this.

If you open picture in Xojo on Windows with GDI+, the image is profiled to match color space of screen, so it looks right. Without GDI+, the pictures are just passed as they are.

You can use MBS Plugin classes for TIFF, PNG and JPEG to read images without applying profile and get ICC profile. You can use LCMS functions to work with profile.

Ok, thanks Christian. I have been working with your examples and understanding the process but still a bit worried about the new empty pictures I may create as this won’t have any profile.

Then, the correct workflow would be:

1.- Open the picture with Jpegimportermbs, read the profile.
2.- Convert to target profile with LCMS2-MBS
3.- Create a new empty picture to draw my converted pictures
4.- Save the result using Jpegexportermbs with embeded profile

I don’t need to manage the color on the empty new picture where I draw the others, correct ? Drawing on an empty picture graphics only draws pixels without any management or conversion, if I draw a converted image on it then the pixels remain converted.

I would expect drawing from one picture to other will not change colors.

Try it. You’ll have to learn some details there.

On the Mac, this can all be done with NSImage, CoreImage or CoreGraphics declares. In fact Xojo should already be doing color management throughout the process.

This depends on many factors, especially the color space of the source image, the bit depth of the image, rendering intent, colorspace and bitdepth of the target destination, file format the image is being written to and of course if the color profile is actually written to disk.

On OS X Xojo converts everything on opening to generic RGB color space.
A lot of clients I have don’t want that.

[quote=212537:@Christian Schmitz]On OS X Xojo converts everything on opening to generic RGB color space.
A lot of clients I have don’t want that.[/quote]
SRGB is one of the better color spaces to convert too, however I concur that for ‘proper’ color management you should respect the original color space (if you can).

[quote=212521:@Sam Rowlands]
This depends on many factors, especially the color space of the source image, the bit depth of the image, rendering intent, colorspace and bitdepth of the target destination, file format the image is being written to and of course if the color profile is actually written to disk.[/quote]

In case the target destination is a picture created in code I guess there is no way to assign a colorspace to it, right?

@Sam Rowlands
Most times I want to convert from source color space to destination, e.g. CMYK.
And than I want to avoid converting first by OS to Generic RGB or Display. That gives a loose in quality.

So using plugin to directly convert from source to dest is often best.

@Alejandro Fresno Meyer
All pictures created on Windows should be in screen color space and on Mac in generic RGB.

Not that I’m aware of.

[quote=212556:@Christian Schmitz]@Alejandro Fresno Meyer
All pictures created on Windows should be in screen color space and on Mac in generic RGB.[/quote]

That confuses me: Do you mean that a New Picture is created in screen color space or RGB even if this picture is never displayed?
And in this case, drawing an Adobe RGB picture opened with your plugin (JpegImporter) in the new picture will be also converted to screen color space or RGB loosing the source color space info?

I have made some tests replicating this process in Photoshop with sRGB and Adobe RGB Jpegs and Tiffs and the result is exactly the same (at least in a workable size of 7000x3000 pixels) as if I use Xojo and your plugins to open and convert the pictures.
The only process difference is that in Photoshop I can create a new document with an assigned color space, added pictures are converted to this space and finally I save it embeding the profile; in Xojo I create a new picture with no profile and add others converting them to the profile I choose, finally I save it embeding the profile.

Of course, I understand that in case I want to display this picture in a canvas f.s. I have to convert it to screen space or generic RGB.

The plugin loads a picture in AdobeRGB into a Xojo picture by putting pixels there directly. This will not change color.
You end up with a picture object with wrong color space. But that is not a problem as you simply ignore the color space.

If you want to display such a picture, you have to transform it to generic RGB via LCMS, so the OS will show correct.

This topic is difficult and confusing, I know.

Thanks Christian, that’s the way I have done it and seems to work fine.