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

[Documentation] Getting the "best" results from pngquant #380

Open
rubyFeedback opened this issue Aug 27, 2021 · 1 comment
Open

[Documentation] Getting the "best" results from pngquant #380

rubyFeedback opened this issue Aug 27, 2021 · 1 comment

Comments

@rubyFeedback
Copy link

Heya kornelski,

This issue request requires a bit of background to explain properly.

I do not remember when I first found pngquant - perhaps 4 years
ago or something like that. I have used it for quite some time
already, and overall I'd like to say that i am super-happy with it.

Right now I am working for a small logo for an "expendable"
ruby project - libui_paradise. The core of the logo I created
via cfdg (context free design rules), then I took that as a base
and modified it via gimp and kolourpaint (yes I use kolourpaint,
either I am getting dumber as I get older, or gimp is getting
worse, whereas kolourpaint becomes better ... it's strange).

And as the "finishing touch" I then delegate to ruby again,
to invoke pngquant for me.

So to explain that result:

ImageParadise::Optimizer: pngquant --force --quality=40-100 --strip --skip-if-larger --verbose LIBUI_PARADISE_LOGO.png

Led to this:

ImageParadise::Optimizer: The old filesize of `LIBUI_PARADISE_LOGO.png` was:  93286
ImageParadise::Optimizer: The new filesize of `LIBUI_PARADISE_LOGO.png` is:   30713

I then compared the two .png files in the browser; old one in the tab to the left,
new one in the tab to the right. Although a few differences could be seen, I
determined that the quality generated was perfect. That's almost 1/3 of the size!

So from this point of view, pngquant is super-great. I hardly could notice any difference,
and I am not an expert, so perhaps one could achieve even better results.

Now there is one thing ... which is why I created this issue request in the end.

I am a noob in the end. I am also lazy. I only use ruby so I can do more with
less at a later time. :P

What I would love to see is a kind of "hints" or "recommendations", a guide if
you so will, about how to best use pngquant from a semi-advanced point
of view. I don't refer to newcomers, but I also don't refer to image experts
who know every trick already. I refer more to the "middle guy or gal" - those
who are past the newbie stage but still sort of feel like newbies.

So, what would I like to see?

Well - I'd love to see a page, ideally available within pngquant, or into
the doc/ subdirectory, or perhaps the github wiki (but I would prefer
something like the main README) - does not have to be IN the
README but perhaps some link towards that, like tricks or hints
or advice or something like that.

That page should give some hints and advice what could be feasible
done. I don't expect this page to give tons of hints, mind you. People
should still research on their own rather than tap away time from
the author of a project. But more like a jump-start guide for people
to play around a bit, see which results yield to improvements and
what not - a bit like imagemagick did, or at the least they used to do
in the past. You could see many images and the options were
explained. Something like that for pngquant would be nice to have,
so that people can see what they may "miss", or better results to
use.

I don't expect this to be too long by the way! Something like 2-4
normal paragraphs in a single page should be more than enough.
My intention is not to draw away a full weekend. :P More something
that could be written in 1-2 hours or so. This can be a starter, and
once it exists you could ask people to contribute a bit, like a FAQ,
with a limited duration say "in the coming six months I'll add more
examples provided by contributors" e. g. on the github page or
elsewhere, and then close that again, so that it does not become
too much of a burden. But I think someone has to start somewhere.

I'd start but I really am not in a position to actually know what I am
doing. All I do is feed pngquant with huge .png files generated by
gimp and see good reductions in the file size. Which works fine
for my use cases actually, but I am always feeling I may miss out
on a few hints or tricks that may yield even better results. (I refer
here to e. g. logos mostly; reallife pictures are obviously something
else, but I create tons of small pictures or use them in webpages,
so the web-focus in this regard is the strongest. Huge pictures I
don't mind that much, I even use jpg for that, but png is more
convenient for the web, e. g. transparency, rounded corners and
so on - I use tons of imagemagick scripts to create such effects,
so pngquant is actually one tool in a toolset-chain already. I'd wish
we'd have that for jpg too but I haven't found something like that
for jpg files yet. pngquant works very well for .png, I guess you know
that already from feedback provided.)

At any rate, please do feel free to ignore this issue or close it at
any moment in time - I know some devs like to keep the issue
tracker clean (like jeremy in sequel) and this is ultimately a documentation
"issue", not software-behaviour issue. Cheers!

@kornelski
Copy link
Owner

kornelski commented Aug 29, 2021

Instead of writing a guide how to tune the program for best results, I've made the program tune itself for best results whenever possible.

The default quality range is the best you can have. The default speed is the best trade-off between speed and quality.

For every image type I could find, pngquant does its best within limitations of the PNG8 format. It's not ideal for every type of image, but in those cases it's not a matter of adding more flags, but a need to use another image format like JPEG or AVIF. --skip-if-larger usually handles that.

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

2 participants