Yes, JPEG or JPG images are of two types. RGB JPG meant for display of Computer screen and CMYK JPG, primarily meant for printing purpose.
Through naked human eyes it is not possible to detect and identify the type of JPG file. There are various ways which can be used to detect the type of JPG. You can use PHP, ASP, Java to read the Exif Metadata of image to identify the Image. However, it requires you to write a program and understanding of the other basics of image handling tasks.
I did face the need to detect the type of JPG as I started getting Red Mark in IE using java program. If JPG is of CMYK, then you may get Red mark in Internet explorer in place of image. (As image file is missing). Also the thumbnail of CMYK JPG would be a solid blue or black color (or Inverted color) , instead of real image.
How to detect the CMYK JPG image?
Here ImageMagick will help you .
As you know ImageMagick provides is a set of API, libraries for Graphics handling which can be used with various programming language. ImageMagick also comes as a standalone suite for MS windows. The best part is , it comes as portable hence you need not to install it.
As a first step , download the ImageMagick suite from "http://www.imagemagick.org/download/binaries/ImageMagick-6.6.4-Q16-windows.zip "
Extract this zip file.It comes with various command line tools . The tool which matter for us here is “identify.exe” See what its documentation says
The identify program describes the format and characteristics of one or more image files. It also reports if an image is incomplete or corrupt. The information returned includes the image number, the file name, the width and height of the image, whether the image is colormapped or not, the number of colors in the image, the number of bytes in the image, the format of the image (JPEG, PNM, etc.), and finally the number of seconds it took to read and process the image.
-------------------------------------------------------------------------------------------------------
Now we will se how this tool will serve our purpose. Take any RGB JPG image , and copy it to location where “identify.exe" is placed. Now run the following command
D:\ImageMagick-6.6.4-7> Identify –verbose Imagefile.jpg
The Identify command display whole lot of information about image . To get pinpoint information about the type of Image you can Pipe and then filter results by using "Findstr" , a PowerShell command available in windows XP/vista/7. Use this command in following way for image named as "IndiaMap1.jpg".
RGB Colorspace image
D:\ImageMagick-6.6.4-7> Identify –verbose IndiaMap1.jpg |findstr /L “colorspace”
The result would be
Colorspace: RGB
If image is of CMYK type then the value of Colorspace will be “CMYK".
CMYK Colorspace Image
D:\ImageMagick-6.6.4-7> Identify –verboseIndiaMap2.jpg |findstr /L “colorspace”
The result would be
Colorspace: CMYK
You can use this command in following way to get info about multiple image files
D:\ImageMagick-6.6.4-7> Identify –verbose IndiaMap1. jpg IndiaMap2.jpg |findstr /L “colorspace”
Output would be
Colorspace: RGB
Colorspace: CMYK
So with the help of "Identify" command utility of ImageMagick Suite , you can identify the JPG type RGb or CMYK!Happy identification !
Write your comments!