Persits Software, Inc. Knowledge Base Articles

HOWTO: Convert CMYK images to RGB

Problem Summary

CMYK images cannot be viewed over the web. This article explains how to convert an image from the CMYK to RGB color space for web viewing.

Solution

Starting with version 1.5, AspJpeg is capable of converting JPEG and TIFF images created in the CMYK color space to JPEG images in the RGB color space. The conversion is performed by calling the ToRGB method which accepts no arguments and returns no values. If the image being converted is not a CMYK, the method will simply do nothing.

For better performance, it is advisable to call this method after setting the new image width and height, if applicable:

Jpeg.Open "c:\path\image.jpg"
Jpeg.PreserveAspectRatio = True
Jpeg.Width = 100

Jpeg.ToRGB ' Convert to RGB

Jpeg.Save "c:\path\thumb.jpg"

The latest version of AspJpeg can be downloaded from www.aspjpeg.com.