Created attachment 127375 [details] A mountainous landscape screenshotted & downloaded from MapCrunch SUMMARY When I try to select a screenshot I've downloaded from mapcrunch as a reference image I get the error message "Could not load C:/Users/(name)/Desktop/References/Environment/Photography/MapCrunch/28508396.png." It works with any other image file on my computer that I've tested, even if it's a file from that same directory. Renaming or moving the screenshots doesn't fix the problem either. The tool is able to insert the images if I drag them to my browser and copy from there, and use the "paste reference image from system clipboard" option. STEPS TO REPRODUCE 1. Select "Reference Image Tool" 2. Go to Tool Options and select "Add Reference Image" 3. Navigate to and select the file OBSERVED RESULT "Could not load C:/Users/(name)/Desktop/References/Environment/Photography/MapCrunch/28508396.png." EXPECTED RESULT Image is inserted as a reference image. SOFTWARE/OS VERSIONS Windows: 10 Qt Version: 5.12.7
I have no problems inserting that image as a reference image, but: it's a jpeg image not a png image. Opening with another image viewer gives the following error: libpng error: Not a PNG file QImageReader::read() using format hint "png" failed: "Unknown error" A bad Qt image decoder moved the buffer to 8 in a call to canRead()! Rewinding. Image format is actually "jpeg" not "png" I'll reboot to Windows to see whether has more problems with mis-named image files than Linux.
Yes, on Windows the detection of the file type is different than on Linux, apparently, and depends only on the extension.
Curiouser... Even if I rename it to .jpg, the image fails to load on Windows.
Git commit f35fba8e4a6bab6b2d037044e2569f0c184278c8 by Boudewijn Rempt. Committed on 08/04/2020 at 12:43. Pushed by rempt into branch 'master'. Use QImageReader to read the reference images QImage::load can in some versions of Qt refuse to load an image with the wrong extension, e.g. a file.png that's actually a jpeg file. By using QImageReader we can make sure Krita only checks the actual contents of the image to determine its type. M +12 -2 libs/ui/KisReferenceImage.cpp https://invent.kde.org/kde/krita/commit/f35fba8e4a6bab6b2d037044e2569f0c184278c8
Git commit 64737d8390534239bf02de9421bd210ddb05c6e4 by Boudewijn Rempt. Committed on 08/04/2020 at 12:45. Pushed by rempt into branch 'krita/4.3'. Use QImageReader to read the reference images QImage::load can in some versions of Qt refuse to load an image with the wrong extension, e.g. a file.png that's actually a jpeg file. By using QImageReader we can make sure Krita only checks the actual contents of the image to determine its type. (cherry picked from commit f35fba8e4a6bab6b2d037044e2569f0c184278c8) M +12 -2 libs/ui/KisReferenceImage.cpp https://invent.kde.org/kde/krita/commit/64737d8390534239bf02de9421bd210ddb05c6e4