r23517 by jghali - Check also sRGB flag in PNGs when retrieving embedded ICC profiles

scribus-commit scribus-commit at lists.scribus.net
Thu Mar 19 20:58:32 UTC 2020


Author: jghali
Date: Thu Mar 19 20:58:32 2020
New Revision: 23517

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23517
Log:
Check also sRGB flag in PNGs when retrieving embedded ICC profiles

Modified:
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_png.cpp

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_png.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23517&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_png.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_png.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_png.cpp	Thu Mar 19 20:58:32 2020
@@ -87,7 +87,7 @@
 	png_set_read_fn(pngPtr, &pngFile, ScImgDataLoader_PNG_read_fn);
 	png_read_info(pngPtr, pngInfo);
 
-	// Read image profile
+	// Read image profile
     png_charp profileName;
 	png_bytep profileData;
 	int compression_type;
@@ -108,8 +108,18 @@
 			m_embeddedProfile = profArray;
 		}
 	}
-
-    pngFile.close();
+	else if (png_get_valid(pngPtr, pngInfo, PNG_INFO_sRGB))
+	{
+		QByteArray profArray;
+		ScColorProfile prof = ScCore->defaultEngine.createProfile_sRGB();
+		if (prof.save(profArray))
+		{
+			m_embeddedProfile = profArray;
+			m_profileComponents = 3;
+		}
+	}
+
+    pngFile.close();
     png_destroy_read_struct(&pngPtr, &pngInfo, (png_infopp) NULL);
 }
 




More information about the scribus-commit mailing list