|
|
#1 |
|
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 53,119
Karma: 181177243
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Issue with large PNG image
I edited an ePub for my spouse today and thee was a rather large .png image which Sigil's image viewer refused to open when I double-clicked on it. Using the View Image option allowed me to see the image with the size reported as 0x0 pixels. But doesn't everybody use a 4671x15231 pixel image for a chapter header?
|
|
|
|
|
|
#2 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,794
Karma: 7500000
Join Date: Nov 2009
Device: many
|
Thanks for the test case. I will try to pass that image through a png validator to make sure it is not corrupt. If it is valid, I will try to figure out why Qt QImage (what Sigil's Image Tab uses) can not read it but View Image (QtWebEngine) can?
|
|
|
|
|
|
#3 |
|
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 53,119
Karma: 181177243
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
For what it may be worth, I checked the dagger.png file using PNGCheck 4.01 and it seemed happy.
D:\tester\>pngcheck -v dagger.png File: dagger.png (1930112 bytes) chunk IHDR at offset 0x0000c, length 13 4671 x 15231 image, 32-bit RGB+alpha, non-interlaced chunk pHYs at offset 0x00025, length 9: 11811x11811 pixels/meter (300 dpi) chunk iTXt at offset 0x0003a, length 1481, keyword: XML:com.adobe.xmp uncompressed, no language tag no translated keyword, 1460 bytes of UTF-8 text chunk IDAT at offset 0x0060f, length 1048576 zlib: deflated, 32K window, default compression chunk IDAT at offset 0x10061b, length 879953 chunk IEND at offset 0x1d7378, length 0 No errors detected in dagger.png (6 chunks, 99.3% compression). |
|
|
|
|
|
#4 | |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,794
Karma: 7500000
Join Date: Nov 2009
Device: many
|
Actually, I get a nice error message from MacOS or Qt that says the following:
Quote:
Do you get the same error message box? So this image breaks some limit internal to Qt QImages. I will see if there is any way to relax that limit. |
|
|
|
|
|
|
#5 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,794
Karma: 7500000
Join Date: Nov 2009
Device: many
|
And the issue is QImage converts all images to 32 bpp to enable the highest quality editing. This image should have been at 8bpp but QImage makes it a 32 bpp on load. There is no way to change that until after loading so this is a catch-22.
So 1 byte vs 4 bytes per pixel change. So if this image is loaded in a QImage this image is at least 4 times bigger than the approximately 2 megabyte (or more once uncompressed) current file size! And of course, there is also an allocation limit internal to QImage, but there is an environment variable to change it. QT_IMAGEIO_MAXALLOC This is supposed to be in "megabytes" but I have no idea. So you might want try setting this env variable to 320. Does that allow this image to seen/edited in its Tab? Update: I checked this and its value is in megabytes and in Qt master this is set to: https://github.com/qt/qtbase/blob/ac...eader.cpp#L435 256 MB. And 4671 x 15231 image, 32-bit (4 bytes per pixel) = 284576004 bytes which exceeds that limit. Setting that environment var to 0 should disable the maximum limit according to the Qt source. But that is just such a stupid size (4671 x 15231) for an epub image! Not sure there is anything we on Sigil's end should do, here. Last edited by KevinH; Today at 10:05 AM. |
|
|
|
|
|
#6 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,794
Karma: 7500000
Join Date: Nov 2009
Device: many
|
Tested setting that env var to 320 and sure enough Sigil's Image Tab was able to load and edit it.
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem with large png image | Liudprand | Conversion | 6 | 03-08-2023 01:40 PM |
| Koreader Png issue | Emix83 | KOReader | 7 | 11-29-2022 11:18 PM |
| svg image on top of a background png image | roger64 | ePub | 25 | 04-24-2015 11:00 AM |
| Display of a png image linked to a svg image | roger64 | Editor | 6 | 03-13-2015 06:21 AM |
| hotlinking png image | bobcdy | Sigil | 21 | 09-21-2010 04:56 AM |