https://stackoverflow.com/questions/22561176/lcms2-convert-cmyk-to-rgb-throu... this was answered like this === copy === hTransform = cmsCreateTransform(hInProfile, TYPE_CMYK_8, hOutProfile, TYPE_ARGB_8, // ARGB is most likely for QImage INTENT_PERCEPTUAL, 0); uchar *in = outImage->bits(); // bits() is equivalent to scanLine(0) uchar *out = outImage->bits(); cmsDoTransform(hTransform, in, out, outImage->byteCount() / sizeof(QRgb)); === official article show bigger switch https://littlecms.com/blog/2020/12/09/using-lcms2-on-qt/ /** * Convert from Qt format to lcms2 format */ static cmsUInt32Number toLcmsFormat(QImage::Format fmt) { switch (fmt) { case QImage::Format_ARGB32: // (0xAARRGGBB) case QImage::Format_RGB32: // (0xffRRGGBB) return TYPE_BGRA_8; case QImage::Format_RGB888: return TYPE_RGB_8; // 24-bit RGB format (8-8-8). case QImage::Format_RGBX8888: case QImage::Format_RGBA8888: return TYPE_RGBA_8; case QImage::Format_Grayscale8: return TYPE_GRAY_8; case QImage::Format_Grayscale16: return TYPE_GRAY_16; case QImage::Format_RGBA64: case QImage::Format_RGBX64: return TYPE_RGBA_16; case QImage::Format_BGR888: return TYPE_BGR_8; default: return 0; } } so I think we can add support for rgb8 timeline format at least, in same place where swscale call done in our ffmpeg.C in ffmpeg we have libavfilter/vf_iccdetect.c #include <lcms2.h> const AVFrameSideData *sd; cmsHPROFILE profile; sd = av_frame_get_side_data(frame, AV_FRAME_DATA_ICC_PROFILE); profile = cmsOpenProfileFromMemTHR(s->icc.ctx, sd->data, sd->size); cmsCloseProfile(profile); Full documentation in pdf form https://www.littlecms.com/LittleCMS2.18%20tutorial.pdf TYPE_RGB_FLT/TYPE_RGBA_FLT exist in /usr/include/lcms2.h so rgba-float should be supportable too. I'll try to write easy detect part for configure first.
I tried to stuff cmsDoTransform into our ffmpeg.C but it does not work :( as in, it does not even come to this newly added block ... does not print colormodel or "cms!" line On Fri, May 1, 2026 at 11:07 AM Andrew Randrianasulu <randrianasulu@gmail.com> wrote:
https://stackoverflow.com/questions/22561176/lcms2-convert-cmyk-to-rgb-throu...
this was answered like this
=== copy ===
hTransform = cmsCreateTransform(hInProfile, TYPE_CMYK_8, hOutProfile, TYPE_ARGB_8, // ARGB is most likely for QImage INTENT_PERCEPTUAL, 0);
uchar *in = outImage->bits(); // bits() is equivalent to scanLine(0) uchar *out = outImage->bits();
cmsDoTransform(hTransform, in, out, outImage->byteCount() / sizeof(QRgb));
===
official article show bigger switch
https://littlecms.com/blog/2020/12/09/using-lcms2-on-qt/
/** * Convert from Qt format to lcms2 format */ static cmsUInt32Number toLcmsFormat(QImage::Format fmt) { switch (fmt) { case QImage::Format_ARGB32: // (0xAARRGGBB) case QImage::Format_RGB32: // (0xffRRGGBB) return TYPE_BGRA_8;
case QImage::Format_RGB888: return TYPE_RGB_8; // 24-bit RGB format (8-8-8).
case QImage::Format_RGBX8888: case QImage::Format_RGBA8888: return TYPE_RGBA_8;
case QImage::Format_Grayscale8: return TYPE_GRAY_8;
case QImage::Format_Grayscale16: return TYPE_GRAY_16;
case QImage::Format_RGBA64: case QImage::Format_RGBX64: return TYPE_RGBA_16;
case QImage::Format_BGR888: return TYPE_BGR_8;
default: return 0;
} }
so I think we can add support for rgb8 timeline format at least, in same place where swscale call done in our ffmpeg.C
in ffmpeg we have
libavfilter/vf_iccdetect.c
#include <lcms2.h> const AVFrameSideData *sd; cmsHPROFILE profile;
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_ICC_PROFILE); profile = cmsOpenProfileFromMemTHR(s->icc.ctx, sd->data, sd->size);
cmsCloseProfile(profile);
Full documentation in pdf form
https://www.littlecms.com/LittleCMS2.18%20tutorial.pdf
TYPE_RGB_FLT/TYPE_RGBA_FLT exist in /usr/include/lcms2.h
so rgba-float should be supportable too.
I'll try to write easy detect part for configure first.
ah, it "worked" I just need to set "ffmpeg first" (I switched away from it for testing) But I still can't see difference? On Sat, May 2, 2026 at 9:30 AM Andrew Randrianasulu <randrianasulu@gmail.com> wrote:
I tried to stuff cmsDoTransform into our ffmpeg.C but it does not work :(
as in, it does not even come to this newly added block ... does not print colormodel or "cms!" line
On Fri, May 1, 2026 at 11:07 AM Andrew Randrianasulu <randrianasulu@gmail.com> wrote:
https://stackoverflow.com/questions/22561176/lcms2-convert-cmyk-to-rgb-throu...
this was answered like this
=== copy ===
hTransform = cmsCreateTransform(hInProfile, TYPE_CMYK_8, hOutProfile, TYPE_ARGB_8, // ARGB is most likely for QImage INTENT_PERCEPTUAL, 0);
uchar *in = outImage->bits(); // bits() is equivalent to scanLine(0) uchar *out = outImage->bits();
cmsDoTransform(hTransform, in, out, outImage->byteCount() / sizeof(QRgb));
===
official article show bigger switch
https://littlecms.com/blog/2020/12/09/using-lcms2-on-qt/
/** * Convert from Qt format to lcms2 format */ static cmsUInt32Number toLcmsFormat(QImage::Format fmt) { switch (fmt) { case QImage::Format_ARGB32: // (0xAARRGGBB) case QImage::Format_RGB32: // (0xffRRGGBB) return TYPE_BGRA_8;
case QImage::Format_RGB888: return TYPE_RGB_8; // 24-bit RGB format (8-8-8).
case QImage::Format_RGBX8888: case QImage::Format_RGBA8888: return TYPE_RGBA_8;
case QImage::Format_Grayscale8: return TYPE_GRAY_8;
case QImage::Format_Grayscale16: return TYPE_GRAY_16;
case QImage::Format_RGBA64: case QImage::Format_RGBX64: return TYPE_RGBA_16;
case QImage::Format_BGR888: return TYPE_BGR_8;
default: return 0;
} }
so I think we can add support for rgb8 timeline format at least, in same place where swscale call done in our ffmpeg.C
in ffmpeg we have
libavfilter/vf_iccdetect.c
#include <lcms2.h> const AVFrameSideData *sd; cmsHPROFILE profile;
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_ICC_PROFILE); profile = cmsOpenProfileFromMemTHR(s->icc.ctx, sd->data, sd->size);
cmsCloseProfile(profile);
Full documentation in pdf form
https://www.littlecms.com/LittleCMS2.18%20tutorial.pdf
TYPE_RGB_FLT/TYPE_RGBA_FLT exist in /usr/include/lcms2.h
so rgba-float should be supportable too.
I'll try to write easy detect part for configure first.
aww, forgot to check if side data exist ... It crashes if I load file _without_ such side data, so in a sense it detect such files correctly? On Sat, May 2, 2026 at 9:48 AM Andrew Randrianasulu <randrianasulu@gmail.com> wrote:
ah, it "worked"
I just need to set "ffmpeg first" (I switched away from it for testing)
But I still can't see difference?
On Sat, May 2, 2026 at 9:30 AM Andrew Randrianasulu <randrianasulu@gmail.com> wrote:
I tried to stuff cmsDoTransform into our ffmpeg.C but it does not work :(
as in, it does not even come to this newly added block ... does not print colormodel or "cms!" line
On Fri, May 1, 2026 at 11:07 AM Andrew Randrianasulu <randrianasulu@gmail.com> wrote:
https://stackoverflow.com/questions/22561176/lcms2-convert-cmyk-to-rgb-throu...
this was answered like this
=== copy ===
hTransform = cmsCreateTransform(hInProfile, TYPE_CMYK_8, hOutProfile, TYPE_ARGB_8, // ARGB is most likely for QImage INTENT_PERCEPTUAL, 0);
uchar *in = outImage->bits(); // bits() is equivalent to scanLine(0) uchar *out = outImage->bits();
cmsDoTransform(hTransform, in, out, outImage->byteCount() / sizeof(QRgb));
===
official article show bigger switch
https://littlecms.com/blog/2020/12/09/using-lcms2-on-qt/
/** * Convert from Qt format to lcms2 format */ static cmsUInt32Number toLcmsFormat(QImage::Format fmt) { switch (fmt) { case QImage::Format_ARGB32: // (0xAARRGGBB) case QImage::Format_RGB32: // (0xffRRGGBB) return TYPE_BGRA_8;
case QImage::Format_RGB888: return TYPE_RGB_8; // 24-bit RGB format (8-8-8).
case QImage::Format_RGBX8888: case QImage::Format_RGBA8888: return TYPE_RGBA_8;
case QImage::Format_Grayscale8: return TYPE_GRAY_8;
case QImage::Format_Grayscale16: return TYPE_GRAY_16;
case QImage::Format_RGBA64: case QImage::Format_RGBX64: return TYPE_RGBA_16;
case QImage::Format_BGR888: return TYPE_BGR_8;
default: return 0;
} }
so I think we can add support for rgb8 timeline format at least, in same place where swscale call done in our ffmpeg.C
in ffmpeg we have
libavfilter/vf_iccdetect.c
#include <lcms2.h> const AVFrameSideData *sd; cmsHPROFILE profile;
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_ICC_PROFILE); profile = cmsOpenProfileFromMemTHR(s->icc.ctx, sd->data, sd->size);
cmsCloseProfile(profile);
Full documentation in pdf form
https://www.littlecms.com/LittleCMS2.18%20tutorial.pdf
TYPE_RGB_FLT/TYPE_RGBA_FLT exist in /usr/include/lcms2.h
so rgba-float should be supportable too.
I'll try to write easy detect part for configure first.
Ok, I tried to add env. variable for profile but it still does not work ? CIN_CM_PROFILE=/usr/share/color/icc/colord/ProPhotoRGB.icc bin/cin /dev/shm/R2020-P3-color-bars.png as in, it just show same picture! On Sat, May 2, 2026 at 9:59 AM Andrew Randrianasulu <randrianasulu@gmail.com> wrote:
aww, forgot to check if side data exist ... It crashes if I load file _without_ such side data, so in a sense it detect such files correctly?
On Sat, May 2, 2026 at 9:48 AM Andrew Randrianasulu <randrianasulu@gmail.com> wrote:
ah, it "worked"
I just need to set "ffmpeg first" (I switched away from it for testing)
But I still can't see difference?
On Sat, May 2, 2026 at 9:30 AM Andrew Randrianasulu <randrianasulu@gmail.com> wrote:
I tried to stuff cmsDoTransform into our ffmpeg.C but it does not work :(
as in, it does not even come to this newly added block ... does not print colormodel or "cms!" line
On Fri, May 1, 2026 at 11:07 AM Andrew Randrianasulu <randrianasulu@gmail.com> wrote:
https://stackoverflow.com/questions/22561176/lcms2-convert-cmyk-to-rgb-throu...
this was answered like this
=== copy ===
hTransform = cmsCreateTransform(hInProfile, TYPE_CMYK_8, hOutProfile, TYPE_ARGB_8, // ARGB is most likely for QImage INTENT_PERCEPTUAL, 0);
uchar *in = outImage->bits(); // bits() is equivalent to scanLine(0) uchar *out = outImage->bits();
cmsDoTransform(hTransform, in, out, outImage->byteCount() / sizeof(QRgb));
===
official article show bigger switch
https://littlecms.com/blog/2020/12/09/using-lcms2-on-qt/
/** * Convert from Qt format to lcms2 format */ static cmsUInt32Number toLcmsFormat(QImage::Format fmt) { switch (fmt) { case QImage::Format_ARGB32: // (0xAARRGGBB) case QImage::Format_RGB32: // (0xffRRGGBB) return TYPE_BGRA_8;
case QImage::Format_RGB888: return TYPE_RGB_8; // 24-bit RGB format (8-8-8).
case QImage::Format_RGBX8888: case QImage::Format_RGBA8888: return TYPE_RGBA_8;
case QImage::Format_Grayscale8: return TYPE_GRAY_8;
case QImage::Format_Grayscale16: return TYPE_GRAY_16;
case QImage::Format_RGBA64: case QImage::Format_RGBX64: return TYPE_RGBA_16;
case QImage::Format_BGR888: return TYPE_BGR_8;
default: return 0;
} }
so I think we can add support for rgb8 timeline format at least, in same place where swscale call done in our ffmpeg.C
in ffmpeg we have
libavfilter/vf_iccdetect.c
#include <lcms2.h> const AVFrameSideData *sd; cmsHPROFILE profile;
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_ICC_PROFILE); profile = cmsOpenProfileFromMemTHR(s->icc.ctx, sd->data, sd->size);
cmsCloseProfile(profile);
Full documentation in pdf form
https://www.littlecms.com/LittleCMS2.18%20tutorial.pdf
TYPE_RGB_FLT/TYPE_RGBA_FLT exist in /usr/include/lcms2.h
so rgba-float should be supportable too.
I'll try to write easy detect part for configure first.
participants (1)
-
Andrew Randrianasulu