[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [krita/krita/3.1] libs/ui: BUG:363003 Load png's with broken resolution tag
From: Boudewijn Rempt <boud () valdyas ! org>
Date: 2016-11-02 10:55:25
Message-ID: E1c1tCX-0000Hv-OR () code ! kde ! org
[Download RAW message or body]
Git commit 259d2ed6610fd60e863f14bde79a3295950ffc16 by Boudewijn Rempt.
Committed on 02/11/2016 at 10:54.
Pushed by rempt into branch 'krita/3.1'.
BUG:363003 Load png's with broken resolution tag
The sample PNG has a resolution of 0,0 set, and PNG_RESOLUTION_METER
as unit type, which is invalid and wrong, but now we can at least
handle it.
M +4 -4 libs/ui/kis_png_converter.cpp
http://commits.kde.org/krita/259d2ed6610fd60e863f14bde79a3295950ffc16
diff --git a/libs/ui/kis_png_converter.cpp b/libs/ui/kis_png_converter.cpp
index 1248587..6d8c26b 100644
--- a/libs/ui/kis_png_converter.cpp
+++ b/libs/ui/kis_png_converter.cpp
@@ -645,7 +645,7 @@ png_get_text(png_ptr, info_ptr, &text_ptr, &num_comments);
png_uint_32 x_resolution, y_resolution;
png_get_pHYs(png_ptr, info_ptr, &x_resolution, &y_resolution, &unit_type);
- if (unit_type == PNG_RESOLUTION_METER) {
+ if (x_resolution > 0 && y_resolution > 0 && unit_type == PNG_RESOLUTION_METER) {
m_image->setResolution((double) POINT_TO_CM(x_resolution) / 100.0, (double) \
POINT_TO_CM(y_resolution) / 100.0); // It is the "invert" macro because we convert \
from pointer-per-inchs to points }
@@ -665,7 +665,7 @@ png_get_text(png_ptr, info_ptr, &text_ptr, &num_comments);
} else if (key == "description") {
info->setAboutInfo("comment", text_ptr[i].text);
} else if (key == "author") {
- qDebug()<<"Author:"<<text_ptr[i].text;
+ qDebug()<<"Author:"<<text_ptr[i].text;
info->setAuthorInfo("creator", text_ptr[i].text);
} else if (key.contains("Raw profile type exif")) {
decode_meta_data(text_ptr + i, layer->metaData(), "exif", 6);
@@ -1022,9 +1022,9 @@ KisImageBuilder_Result KisPNGConverter::buildFile(QIODevice* \
iodevice, const QRe
* This automatically writes the correct gamma and chroma chunks along with the \
sRGB chunk, but firefox's
* color management is bugged, so once you give it any incentive to start color \
managing an sRGB image it
* will turn, for example, a nice desaturated rusty red into bright poppy red. \
So this is disabled for now.
- */
+ */
/*if (!options.saveSRGBProfile && sRGB) {
- png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, PNG_sRGB_INTENT_PERCEPTUAL);
+ png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, PNG_sRGB_INTENT_PERCEPTUAL);
}*/
// set the palette
if (color_type == PNG_COLOR_TYPE_PALETTE) {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic