Errors importing png files

I am getting a number of errors when I try to import some png files.

This from the import dialog:

{“msg”:“Failed to import item.”,“stack”:“Error: Input buffer has corrupt header: pngload_buffer: too many text chunks\n”,“system”:“Windows_NT 10.0.22621 (x64)”,“time”:1669988008990,“version”:“1.12.0”}

and a number in the log file:

{“level”:40,“time”:1669987862943,“type”:“browser”,“name”:“main”,“stack”:“Error: EPERM: operation not permitted, symlink ‘C:\Users\graha\AppData\Local\tropy\app-1.12.0\resources\app.asar\res\plugins\README.md’ → ‘C:\Users\graha\AppData\Roaming\Tropy\plugins\README.md’”,“msg”:“failed to link plugins readme”}

{“level”:40,“time”:1669987959682,“type”:“renderer”,“name”:“project”,“stack”:“Error: Input buffer has corrupt header: pngload_buffer: too many text chunks\n”,“msg”:“failed to import "D:\Graham\Pictures\My Pictures\nnn1.png"”}

{“level”:40,“time”:1669987961036,“type”:“renderer”,“name”:“project”,“stack”:“Error: Input buffer has corrupt header: pngload_buffer: too many text chunks\n”,“msg”:“failed to import "D:\Graham\Pictures\My Pictures\nnn2.png"”}
{“level”:40,“time”:1669987961082,“type”:“renderer”,“name”:“project”,“stack”:“Error: Input buffer has corrupt header: pngload_buffer: too many text chunks\n”,“msg”:“failed to import "D:\Graham\Pictures\My Pictures\nnn3.png"”}
{“level”:40,“time”:1669987961138,“type”:“renderer”,“name”:“project”,“stack”:“Error: Input buffer has corrupt header: pngload_buffer: too many text chunks\n”,“msg”:“failed to import "D:\Graham\Pictures\My Pictures\nnn4.png"”}

{“level”:40,“time”:1669987962180,“type”:“renderer”,“name”:“project”,“stack”:“Error: Input buffer has corrupt header: pngload_buffer: too many text chunks\n”,“msg”:“failed to import "D:\Graham\Pictures\My Pictures\nnn5.png"”}

The relevant png files open without error.

Can someone advise what might be going on?

Thank you.

By open without error I assume you mean you can view them in another application?

Could you send a link to one of the files?

Are you sure this is one of the files? If I download the original file it’s a JPEG (and I can import it without a problem).

That’s interesting. I have tried uploading the png file again but now I see that the forum software converts it to jpg. So here it is in another place town — ImgBB

Thanks! I can reproduce the error with this one. It’s caused by some of the underlying image libraries – we’ll try to figure out why the image is causing this and how we can work around it.

Is it libvips that is being used, as I can see there are quite a few discussions about this error on its pages (and elsewhere) on Github, but you are probaboy already there … ?

Yes, exactly that’s the library that’s used under the hood. Text in image’s EXIF metadata is limited by default for security reasons. We’ll take a look if we can easily change the configuration for the bundled libvips in the upcoming release; as a workaround we’ll also allow metadata extraction to fail during import.

Hi, can you predict when the release that will include this fix will be available?

Thanks.

We’ll try to add the workaround (skipping the metadata extraction if there’s an error) in the upcoming 1.13. We need to update the bundled vips and other binaries for the release after that; when we do that I’ll check if we can change the configuration to allow more metadata fields.

That would be good. I just want to start using Tropy but many png’s like this are holding me up!

Thanks.

Will the workaound be in 1.13?

Thanks.

Yes, it’s already in beta.

Thank you. I’ll give it a try.

I downloaded the Version 1.13.0-beta.5 (x64). Unfortunately, it is still giving me the same error when importing png files.


{"level":30,"time":1677443787750,"type":"renderer","name":"project","mode":"w","msg":"open db D:\\Graham\\Documents\\Png Test.tropy\\project.tpy"}
{"level":40,"time":1677443843281,"type":"renderer","name":"project","stack":"Error: Input buffer has corrupt header: pngload_buffer: too many text chunks\n","msg":"failed to import \"D:\\Graham\\Pictures\\My Pictures\\2-20593.png\""}

Oh, thanks, I thought this should have been addressed already, we’ll take another look. It’ll go into beta.6 in the next few days.

Unfortunately the workaround will not work after all; when reading the header fails we don’t know what the PNGs width/height which are essential for most of the image processing (the error does not just occur when extracting metadata but also when collecting the image stats). So this will have to wait until 1.14 and the new libvips builds.

Quick update, we’ve had to delay 1.13 for unrelated reasons but this allowed us to update libvips and all native image formats for this release after all. The latest beta.7 does include the updated stack. There is still a limit to the PNG text chunks permitted, but the sample image above now imports fine for me.

It’s true I don’t get any errors now. However, I have done some tests and not all images seem to be imported. I have tried both the “standard” and “Advanced” options on a folder (with subfolders) that has about 4000 images, a mix of jpg and png file types. Only 508 images are being imported.

It’s not clear why they are not all being imported. They seem to come in largely in alphanumeric sequence but stop prematurely.

Is there a file size/type setting somewhere?

No error message.

Is there an import log I can access?

If a file is not imported it’s probably due to an error. There’s also a preference to skip duplicate files (duplicates are determined using a checksum). Either way, if you run the import and then check the log file there should be either lots of errors there or notes about duplicates getting skipped.