Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lossless PNG fails with latest 1.70 from flathub #162

Closed
magicmyth opened this issue Apr 25, 2023 · 11 comments
Closed

Lossless PNG fails with latest 1.70 from flathub #162

magicmyth opened this issue Apr 25, 2023 · 11 comments

Comments

@magicmyth
Copy link

Not sure if its the exact same issue as #160 because nothing actually happens for me when I try to lossless compress a PNG except a message of "An unknown error has occured" in the GUI, and with lossy compression the min file is generated but the same error message shows.

Running from the CLI, lossless shows shows:

oxipng -o 7 -i 1 "/PATH/PNG-FILE-min.png" --out "/PATH/PNG-FILE-min.png" --strip safe --preserve

and lossy:

ERROR:root:Command 'pngquant --quality=0-90 -f "/PATH/PNG-FILE.png" --output "/PATH/PNG-FILE-min.png" --strip && oxipng -o 7 -i 1 "/PATH/PNG-FILE-min.png" --out "/PATH/PNG-FILE-min.png" --strip safe --preserve' returned non-zero exit status 2.

So looks like the switch to oxipng has some issues. Note I tried making sure my png file name was as simple as "simple.png" just in case it was some string parsing issue with file naming but the same result happened.

On a side note. "occured" in "An unknown error has occured" should have two "r". Also technically separate issue but drag & drop stopped working with the updating in conjunction with KDE Neon.

@Huluti
Copy link
Owner

Huluti commented May 5, 2023

Can you copy what you have in the debug section in the about window please? It should be something like this:

Python: 3.10.6

Gtk: 4.10.3

Jpegoptim: 1.5.3

Oxipng: 8.0.0

pngquant: 2.18.0

Libwebp: 1.3.0

Scour: 0.38.2

@Huluti
Copy link
Owner

Huluti commented May 5, 2023

Typo fixed btw thanks for reporting it!

@magicmyth
Copy link
Author

Sorry for the delay. Here is my debug info:

Python: 3.10.6

Gtk: 4.10.3

Jpegoptim: 1.5.3

Oxipng: 8.0.0

pngquant: 2.18.0

Libwebp: 1.3.0

Scour: 0.38.2

@Huluti
Copy link
Owner

Huluti commented May 11, 2023

Thanks! And by chance, can you share me an image that does this so I can reproduce please?

@magicmyth
Copy link
Author

It fails with any PNG. I tested one of the Curtail's app screenshots from:

https://github.com/Huluti/Curtail/blob/master/data/screenshots/screen1.png
blob:https://github.com/eaa9eaca-8c87-4716-8a58-022af1088ab4

and I get the same issue.

I though't I'd do a little more debugging. So I popped into the sandbox environment with:

$ flatpak run --command=sh com.github.huluti.Curtail

and ran the command seen on the error output:

[📦 com.github.huluti.Curtail Downloads]$ oxipng -o 7 -i 1 "/PATH/test-file.png" --out "/PATH/test-file-min.png" --strip safe --preserve

Which returned:

error: "7" isn't a valid value for '--opt <level>'
        [possible values: 0, 1, 2, 3, 4, 5, 6, max]

For more information try --help

So tweaking the command with a valid -o value:

oxipng -o max -i 1 "/PATH/test-file.png" --out "/PATH/test-file-min.png" --strip safe --preserve

Resulted in

Processing: /PATH/test-file.png
    324x324 pixels, PNG format
    8 bits/pixel, 256 colors in palette (non-interlaced)
    IDAT size = 31458 bytes
    File size = 46285 bytes
Reducing image to 8 bits/pixel, 183 colors in palette (interlaced)
Trying: 10 filters
    IDAT size = 31458 bytes (0 bytes decrease)
    file size = 32716 bytes (13569 bytes = 29.32% decrease)
failed to set permissions, expected: 100664, found: 100644

So seems like a out of range setting has been stored somewhere causing the error. I went into the Preferences > Compression and the value was "6" but I changed it to 5 and it still failed but this time with exit status 1! My first guess is because I was using the previous version which may have allowed a higher digit supported by OptiPNG. It is still failing but the output suggests a changing permission issue on the file.

Because of the bad stored setting value I thought I'd try with purging my old data by deleting .var/app/com.github.huluti.Curtail, using Flatseal to reset any potential overridden app permissions (pretty sure I never adjusted Curtail but thought best to rule it out) and launching fresh. Unfortunately it is still failing and within the sandbox I still see that same "failed to set permissions".

@magicmyth
Copy link
Author

BTW my flatpak version is: 1.12.7 which comes from the Ubuntu 22.04 repository. Seems there is a PPA now with the latest Flatpak (1.14.4) so I thought I'd try that in case the app relied on newer features but nope. Still failing with that same failed to set permissions, expected: 100664, found: 100644 error.

@Huluti
Copy link
Owner

Huluti commented May 11, 2023

Thank you very much for having done this debugging!
I hadn't thought of the compression level change switching from Optipng to Oxipng. Good catch!
The permission error seems to come from oxipng: https://github.com/shssoichiro/oxipng/blob/a7be8751dce82e6d42936718134a1083b875768c/src/lib.rs#LL929C28-L929C28

Can you try to disable "preserver metadata" option to check if it's fix the problem temporary?

@magicmyth
Copy link
Author

Yep it worked without the --preserve flag!

@Huluti
Copy link
Owner

Huluti commented May 11, 2023

Ok! So just need to find why it fails with. Thank you very much for your help!

@mrmatteastwood
Copy link

Hey, author of bug #189 here. Thanks for pointing me to this. I read it before reporting #189 and, not understanding all the technical details in the above comments, I opted for reporting 189 since it seemed different.

I ran all the latest updates on my laptop today and now the issue I described in bug #189 occurs on this PC, too. Bug #189 was from my desktop PC. There were a bunch of platform-related flatpak things among the updates.

Note that the issue occurs whether the "Preserve metadata" option is enabled or not.

@Huluti
Copy link
Owner

Huluti commented Nov 3, 2023

@mrmatteastwood #189 is fixed in 1.8.0 :)

@magicmyth I updated oxping in 1.8.0. Can you retry and see if it's better now? (when it will be deployed in a few hours to flathub).

@Huluti Huluti closed this as completed Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants