shssoichiro / oxipng

Multithreaded PNG optimizer written in Rust
MIT License
2.95k stars 125 forks source link

Add an option to resize images #644

Closed shssoichiro closed 5 days ago

shssoichiro commented 6 days ago

This is a use case that has arisen as I've frequently found myself taking screenshots on PS5 or Xbox, which are in 4k, and wanting to upload them to Discord. The 4k PNGs coming from the console are still quite large after being run through oxipng. However, if they were downscaled to 1080p, this would significantly reduce the file size.

This is obviously lossy and should be optional, disabled by default.

TPS commented 5 days ago

Your software & so your decision, but not out-of-scope? This is done already by so many software (in so many ways), & needn't bloat oxipng's codebase.

ace-dent commented 5 days ago

To echo @TPS comment: this would duplicate significant functionality from many other programs. e.g. magick "in.png" -sample 50% "out.png"... There is some complexity too... (1, 2).

shssoichiro commented 5 days ago

Your software & so your decision

I created the issue so I wouldn't forget about it.

but not out-of-scope

Possibly. However, I was tired of having to use two programs every time all I really wanted to do was make an image smaller in size. If everyone thinks it's a waste of time though, then it probably is and I'll just make a batch script.

TPS commented 5 days ago

@shssoichiro The only inkling I have toward how this would be apropos for oxipng is:

Perhaps that exists/can be developed? But would take research! 🙇🏾‍♂️

AlexTMjugador commented 4 days ago

For what it's worth, as a developer and Oxipng user, I wouldn't naturally think of using Oxipng for standard image resizing tasks, nor expect it to include that feature. Instead, I'd rely on one of the many dedicated image resizing tools out there, then pass the result to Oxipng for optimization.

That said, if there's a smart, lossless way to resize PNGs, or one that interacts more effectively with compression and is overlooked by standard resizing algorithms (similar to the example mentioned by @TPS), I'd be down to experimenting with such a feature in Oxipng!