summaryrefslogtreecommitdiff
path: root/ff2png.c
diff options
context:
space:
mode:
authorFRIGN <dev@frign.de>2016-01-20 22:31:25 +0100
committerFRIGN <dev@frign.de>2016-01-20 22:31:25 +0100
commite9feca5c2bda05b9a356617868fd4b08ec903d0d (patch)
treec2365c79339e2b020fbd1ecb61ae60c85ae38cdb /ff2png.c
parent291e677210c6c2c1d1eba2f0ba2243806ef63b07 (diff)
Use linear RGB
Makes things a lot easier for image manipulation algorithms which can be expected to be applied to farbfeld data.
Diffstat (limited to 'ff2png.c')
-rw-r--r--ff2png.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/ff2png.c b/ff2png.c
index 9f562b8..03fa1f6 100644
--- a/ff2png.c
+++ b/ff2png.c
@@ -14,7 +14,7 @@
static char *argv0;
-/* ProPhoto RGB */
+/* ROMM RGB primaries (ISO 22028-2:2013) */
static cmsCIExyYTRIPLE primaries = {
/* x, y, Y */
{ 0.7347, 0.2653, 0.288040 }, /* red */
@@ -34,8 +34,8 @@ main(int argc, char *argv[])
{
cmsContext icc_context;
cmsHPROFILE out_prof;
- cmsMLU *mlu1, *mlu2;
- cmsToneCurve *gamma18, *out_curve[3];
+ cmsMLU *mlu1, *mlu2, *mlu3;
+ cmsToneCurve *gamma10, *out_curve[3];
png_structp pngs;
png_infop pngi;
size_t png_row_len, j;
@@ -62,25 +62,27 @@ main(int argc, char *argv[])
width = ntohl(*((uint32_t *)(hdr + 8)));
height = ntohl(*((uint32_t *)(hdr + 12)));
- /* icc profile (ProPhoto RGB) */
+ /* icc profile (linear ROMM RGB (ISO 22028-2:2013)) */
if (!(icc_context = cmsCreateContext(NULL, NULL)))
goto lcmserr;
- if (!(gamma18 = cmsBuildGamma(icc_context, 1.8)))
+ if (!(gamma10 = cmsBuildGamma(icc_context, 1.0)))
goto lcmserr;
- out_curve[0] = out_curve[1] = out_curve[2] = gamma18;
+ out_curve[0] = out_curve[1] = out_curve[2] = gamma10;
if (!(out_prof = cmsCreateRGBProfileTHR(icc_context, cmsD50_xyY(),
&primaries, out_curve)))
goto lcmserr;
cmsSetHeaderFlags(out_prof, cmsEmbeddedProfileTrue | cmsUseAnywhere);
cmsSetHeaderRenderingIntent(out_prof, INTENT_RELATIVE_COLORIMETRIC);
cmsSetDeviceClass(out_prof, cmsSigColorSpaceClass);
- if (!(mlu1 = cmsMLUalloc(NULL, 1)) || !(mlu2 = cmsMLUalloc(NULL, 1)))
+ if (!(mlu1 = cmsMLUalloc(NULL, 1)) || !(mlu2 = cmsMLUalloc(NULL, 1)) ||
+ !(mlu3 = cmsMLUalloc(NULL, 1)))
goto lcmserr;
cmsMLUsetASCII(mlu1, "en", "US", "Public Domain");
cmsWriteTag(out_prof, cmsSigCopyrightTag, mlu1);
- cmsMLUsetASCII(mlu2, "en", "US", "ProPhoto RGB");
- cmsWriteTag(out_prof, cmsSigProfileDescriptionTag, mlu2);
+ cmsMLUsetASCII(mlu2, "en", "US", "aka Linear ProPhoto RGB, Melissa RGB");
cmsWriteTag(out_prof, cmsSigDeviceModelDescTag, mlu2);
+ cmsMLUsetASCII(mlu3, "en", "US", "Linear ROMM RGB (ISO 22028-2:2013)");
+ cmsWriteTag(out_prof, cmsSigProfileDescriptionTag, mlu3);
cmsSaveProfileToMem(out_prof, NULL, &icclen);
if (!(icc = malloc(icclen))) {
fprintf(stderr, "%s: malloc: out of memory\n", argv0);
@@ -101,7 +103,8 @@ main(int argc, char *argv[])
png_set_IHDR(pngs, pngi, width, height, 16, PNG_COLOR_TYPE_RGB_ALPHA,
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
PNG_FILTER_TYPE_BASE);
- png_set_iCCP(pngs, pngi, "ProPhoto RGB", 0, icc, icclen);
+ png_set_iCCP(pngs, pngi, "Linear ROMM RGB (ISO 22028-2:2013)", 0,
+ icc, icclen);
png_write_info(pngs, pngi);
/* write rows */