-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICC not embedded when writing PNG files #4262
Comments
Please ack that this works also for libpng 1.6.x: diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc
--- a/rtengine/imageio.cc
+++ b/rtengine/imageio.cc
@@ -365,10 +365,10 @@
if (png_get_valid(png, info, PNG_INFO_iCCP)) {
png_charp name;
int compression_type;
-#if PNG_LIBPNG_VER_MAJOR > 1 || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR > 4)
+#if PNG_LIBPNG_VER < 10500
+ png_charp profdata;
+#else
png_bytep profdata;
-#else
- png_charp profdata;
#endif
png_uint_32 proflen;
png_get_iCCP(png, info, &name, &compression_type, &profdata, &proflen);
@@ -950,6 +950,11 @@
return IMIO_HEADERERROR;
}
+ // silence the warning about "invalid" sRGB profiles -- see #4260
+#if defined(PNG_SKIP_sRGB_CHECK_PROFILE) && defined(PNG_SET_OPTION_SUPPORTED)
+ png_set_option(png, PNG_SKIP_sRGB_CHECK_PROFILE, PNG_OPTION_ON);
+#endif
+
png_infop info = png_create_info_struct(png);
if (!info) {
@@ -980,6 +985,15 @@
png_set_IHDR(png, info, width, height, bps, PNG_COLOR_TYPE_RGB,
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_BASE);
+ if (profileData) {
+#if PNG_LIBPNG_VER < 10500
+ png_charp profdata = static_cast<png_charp>(profileData);
+#else
+ png_bytep profdata = static_cast<png_bytep>(profileData);
+#endif
+ png_set_iCCP(png, info, const_cast<png_charp>("icc"), 0, profdata, profileLength);
+ }
+
int rowlen = width * 3 * bps / 8;
unsigned char *row = new unsigned char [rowlen]; |
@agriggio awesome to see a patch!
|
@Beep6581 replace with |
|
I should read better the error messages before replying :-) (I am on my phone now so I can't test) |
Compiled! |
Tested, no issues found. Thank you @agriggio , +1 for commit. |
RawTherapee does not embed the ICC profile when writing PNG files!
Output profile: ACES
If I insert the ACES profile into the PNG using ExifTool then it displays correctly when using @agriggio's patch from #4260:
This is the full metadata output of PNG files produced by RawTherapee:
The text was updated successfully, but these errors were encountered: