Colour profile and JPEG 2000

1 view (last 30 days)
Elizabeth Allen
Elizabeth Allen on 28 Oct 2013
Answered: Prateekshya on 16 Oct 2024
Hi,
I have a set of sRGB profiled TIFF files, which I am converting to JPEG2000 in MATLAB using imwrite. Will the colour space be used during the compression, and will the images remain in the sRGB colour space?
Thanks Liz

Answers (1)

Prateekshya
Prateekshya on 16 Oct 2024
Hello Elizabeth,
When you convert sRGB profiled TIFF files to JPEG2000 in MATLAB using the imwrite function, the color space information is typically preserved, but there are some important considerations to keep in mind:
  • sRGB Profile: If your TIFF files contain an embedded sRGB ICC profile, MATLAB will not automatically embed this profile into the JPEG2000 files. However, the pixel data itself will remain in the sRGB color space unless explicitly converted.
  • Compression and Color Space: The compression process itself (using JPEG2000 in this case) does not inherently change the color space of the image data. The image will remain in the sRGB color space unless you perform a color space conversion before writing the file.
  • MATLAB imwrite Function: The imwrite function in MATLAB does not automatically embed color profiles when writing JPEG2000 files. If maintaining the ICC profile is critical, you may need to handle this separately using additional tools or libraries that support ICC profile embedding in JPEG2000.
Recommendations:
  • Verify and Embed ICC Profile: If you need to ensure that the ICC profile is preserved, consider using external tools or libraries that support ICC profile embedding in JPEG2000 files. MATLAB’s imwrite does not natively support this feature.
  • Color Space Conversion: If you need to convert the image to a different color space, you can use MATLAB functions like rgb2xyz, rgb2lab, etc., before writing the file.
  • Post-Processing Tools: After converting the images in MATLAB, you can use tools like Adobe Photoshop, ImageMagick, or specialized JPEG2000 libraries to verify and embed ICC profiles if necessary.
Here is a basic example of how you might convert a TIFF file to JPEG2000 in MATLAB:
% Read the TIFF image
tiffImage = imread('input_image.tiff');
% Write the image to JPEG2000 format
imwrite(tiffImage, 'output_image.jp2', 'CompressionRatio', 10);
I hope this helps!

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!