iCCP Test Images
================

These files are intended to facilitate testing of iCCP chunk (embedded ICC profile support) in applications which use PNG files.

These files are NOT necessarily correct - indeed some of the files are deliberately incorrect in that they do not match the PNG 1.1. specification.  Please report bugs to johnbo@microsoft.com.

The files can be recreated relatively easily using freely available tools, new files can be produced with the same tools.


Principles
==========

The images have been packaged together with this file into a zip archive.  The archive contains files with the same name in two sub-directories:

	sRGB	Normal, supposedly correct, pictures in the original sRGB color space with the appropriate chunks.
	sGRB	Modified images which contain only partial information and which can be used to assess correctness of separate code paths in an application.

Normally the iCCP chunk is accompanied by gAMA and cHRM chunks which replicate the color space information in the ICC profile.  This can make it difficult to detect errors - an application may unintentionally skip the profile and use the gAMA/cHRM chunks.

In addition it is difficult to detect whether or not a profile has been used when that profile is the sRGB profile - this profile is a close match for existing computer monitors therefore the difference between using it and not using it can be undetectable.

The sGRB files address these problems:

	1) The "green" and "red" samples in the files have been swapped, the cHRM and iCCP chunks reflect this swap.  If either is used correctly the images will appear identical to the corresponding sRGB image, otherwise the image will be obviously incorrect.
	2) Each sGRB image uses a different combination of the data (including no color space data at all - this image should never display correctly!)


Tools
=====

Information about the tools used in the production of these images can be obtained from the the following web sites.  (I give the root URLs, in the hope that these won't get out of date too soon.)

Adobe PhotoShop 5: http://www.adobe.com/ - it is necessary to use at least version 5, earlier versions do not support the color space manipulations required.

MNGeye: http://www.3-t.com - I used version 1.10 (en)

pngcrush: http://www.netgsi.com/~glennrp/ used just as a double check to ensure that MNGeye produced PNG files with good compression.

iccdump: http://web.access.net.au/argyll/ follow the links to "color stuff", iccdump is part of the "ICC profile I/O library".

See http://www.cdrom.com/pub/png/ for more general information.


Images
======

The original image files were supplied by Hewlett-Packard, scanned using HP scanners (HP SCanJet 6100C and HP PrecisionScan Pro) producing output in TIFF file format and the sRGB color space.

The images were selected on the basis that each contained colors which are likely to be reasonably familiar to the viewer and thus it is possible to do some basic assessment of the correctness of the colors, however the colors are not calibrated in any way so such tests will be very subjective.

The images were loaded into Adobe PhotoShop 5 from the original TIFF files.  In the case of the sRGB images no profile convertion was done and the PhotoShop RGB color space was set to sRGB.  In the case of the sGRB images the RGB color space had been set to a custom space based on the sRGB end points and gamma but with the red and green end points (chromaticities) swapped, convertion to this color space from the built in sRGB profile was done when the file was imported.

The images were each resampled to a maximum dimension of 320 pixels (the other, narrower, dimension was resampled in proportion.)  The was done with bicubic resampling.

Each image was saved as a PNG file.

The PNG files were renamed with the MNG extension (.mng) (This was done solely because I was unable to write a suitable script from a PNG file imported into MNGeye.)  Each file was loaded into MNGeye and saved as a script ("idat/jdat"), this produces a file IDAT0001.3tn, which was renamed to "imagename.3tn" - this contains the IDAT chunk (stored with a proprietary encoding - see the MNGeye documentation.)

The other chunk information in the script files was discarded - instead gAMA and cHRM chunk values were taken from the PNG 1.1 specification.  #profile lines were added as appropriate.

The rewritten scripts are contained in the zip archive, look for "filename.txt" to find the script for "filename.png".  Notice that the IDAT chunks are not present in the archive - they can be recovered from the PNG files if necessary.

Each script was loaded into MNGeye (file/open script...) then saved as a PNG file.

The custom ICC profile is contained in the file sGRB.icm, notice that this profile has an invalid date (the year is stored in the month field), this can cause some programs to crash so is a useful resiliency check in itself.

Each script file contains a brief comment which describes the chunks in the corresponding file.  In summary the chunks in the files are:

	sGRB/KinnerlyPark94.png  iCCP, cHRM, gAMA
	sGRB/MorningGlory82.png  iCCP
		[Notice that in this file the flowers are *purple* and the background is redish-maroon - because only the red and green channels are swapped this image can be mistakenly interpreted as correct when displayed with swapped channels.]
	sGRB/SnowCrocus14.png    gAMA, cHRM
	sGRB/Tulips27.png        no color space information


Image validation
================

pngcrush was used to attempt to reduce image size.  For the sRGB images it achived a 2% reduction on SnowCrocus14 but no reduction on the other images.  The images in the archive have *not* been processed by pngcrush.

All images were inserted into a beta version of Office2000.  Display was (apparently) correct, except for sGRB/Tulips27 which is not expected to be correct.

The sRGB profile used is the one distributed with Microsoft Windows 98.  The "sGRB" profile was produced by Adobe PhotoShop 5 as a custom RGB setup profile.  Both profiles have been checked using a version of iccdump modified to accept the date format in the sGRB.icm profile.

The validation procedure involves only one generating program for the PNG data and one consuming program.  Clearly this is not quite as bad as just generating and validating the data with one program, but it is still unreliable.


Recommendations
===============
Display the sRGB and the corresponding sGRB image side by side - check for differences.  This set of images can only detect gross errors!

John Bowler <johnbo@microsoft.com>
