Open passivestar opened 3 months ago
I did some testing, playing with export settings in Gimp and seeing what caused an error. And what caused an error - which looks identical to the OP one - was trying to import a jpg exported with the setting "Use arithmetic coding". I cannot guarantee that it is the same issue, but this is the only way I managed to get the error, so I believe it likely is.
Gimp documentation says:
Arithmetic encoding is a form of entropy encoding (a lossless data compression scheme) that, since GIMP-2.10 can be used in exporting as JPEG. Images using arithmetic encoding can be 5 - 10 % smaller. But older software may have trouble opening these images.
Here is a wikipedia article on the topic: https://en.wikipedia.org/wiki/Arithmetic_coding
Here is the picture I created: test.zip
Notes:
Now, this is not a regression. I tested the same picture on multiple versions of Godot, and all versions from Godot 3.2 to 3.6 beta4 and from Godot 4.0 alpha1 to Godot 4.3 dev6 had a similar error (with differences in line number).
I hope this allows you to workaround the issue, and perhaps confirm if your textures use arithmetic coding.
And about fixes... Barring adding support for these pictures, this limitation should be documented, and perhaps the error message could be changed to something more useful.
was trying to import a jpg exported with the setting "Use arithmetic coding"
This option is known for being poorly supported in various programs (even some web browsers will fail to load those JPEGs).
To improve the error message, I'm not sure if there's a reliable way to detect whether a JPEG uses arithmetic coding (either using the jpeg library we're currently using, or by reading the file's bytes directly if it faisl to load).
It seems to be already detected, although I do not know if that is surfaced to Godot: https://github.com/godotengine/godot/blob/master/thirdparty/jpeg-compressor/jpgd.cpp#L1054
This option is known for being poorly supported in various programs (even some web browsers will fail to load those JPEGs)
Tested my problematic images with different software, all of the following load them with no problem:
I couldn't find any app that wouldn't open them. So maybe it's a different problem?
Ok, on my end Firefox won't render my test picture, so you might be correct on this being a different issue.
Notes:
I put an image through some online analyzer and attached the results on top in case that gives any ideas
That confirms it does not have the markers for arithmetic encoding, but for Huffman encoding.
I'll post if I manage to make a test picture that resembles the OP info and causes the import error.
Ok, I have another problematic picture: new_test.zip (this time it is an exclamation mark because why not).
This is a Grayscale image with Chromma subsampling 4:2:0 (Gimp didn't let me set this subsampling, forcing 4:4:4 when using Grayscale, so I had to resource to other tools).
None of the applications that had problems with the old test picture have problems with this one. But the error message on Godot is the same. And I didn't find a version of Godot that would import it either.
None of the applications that had problems with the old test picture have problems with this one. But the error message on Godot is the same. And I didn't find a version of Godot that would import it either.
Can confirm the same behavior on macOS
Here's your test picture loaded in unity with no problem:
Attached your picture as an MRP
Decoding fails here with JPGD_UNSUPPORTED_SAMP_FACTORS
:
Tested versions
v4.3.dev6.official [89850d553]
System information
Godot v4.3.dev6 - macOS 14.4.1 - Vulkan (Forward+) - integrated Apple M1 Max - Apple M1 Max (10 Threads)
Issue description
This is what macos tells me about them:
This is what some online analyzer tells:
RGB textures load with no problem
Steps to reproduce
MRP
Minimal reproduction project (MRP)
Image that gives an identical error provided by @theraot:
https://github.com/user-attachments/files/15511511/new_test.zip