On 9 April 2011 16:26, Richard Hughes <hughsi...@gmail.com> wrote:
> I'm starting to play with named color profiles using lcms2, and I
> wondered if anybody had any links to existing working free profiles I
> can use for testing? Thanks.

Right, I've managed to write a named color profile using lcms that
conforms to the ICC spec. I've not yet managed to read the data out of
it tho.

I've attached a test file and test wrapper. Compile and run with:

gcc -o test test.c -llcms2 && ./test ./x11-colors.icc

This produces for me:

LCMS error 13: Couldn't link the profiles
no transform

I can't seem to get named colors to work at all. Ideas welcome. Thanks!

Richard.
#include <lcms2.h>

static void
error_cb (cmsContext ContextID, cmsUInt32Number errorcode, const char *text)
{
	printf ("LCMS error %i: %s\n", errorcode, text);
}

int
main (int argc, char **argv)
{
	cmsHPROFILE nc_profile;
	cmsHPROFILE xyz_profile;
	cmsHTRANSFORM xform;
	cmsNAMEDCOLORLIST *nc2;

	cmsSetLogErrorHandler (error_cb);

	if (argc != 2) {
		printf ("no file\n");
		goto out;
	}
	nc_profile = cmsOpenProfileFromFile (argv[1], "r");
	xyz_profile = cmsCreateXYZProfile ();
	xform = cmsCreateTransform (nc_profile, TYPE_NAMED_COLOR_INDEX,
				    xyz_profile, TYPE_XYZ_DBL,
				    INTENT_ABSOLUTE_COLORIMETRIC, 0);
	if (xform == NULL) {
		printf ("no transform\n");
		goto out;
	}

	/* retrieve named color list from transform */
	nc2 = cmsGetNamedColorList (xform);
	if (nc2 == NULL) {
		printf ("no named color list\n");
		goto out;
	}
	printf ("SUCCESS!");
out:
	return 1;
}

Attachment: x11-colors.icc
Description: application/vnd.iccprofile

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to