Hi there,
I'm using pngquant (http://pngquant.org/) for some of my images to reduce them to 8-bit of color depth which is often more than enough. pngquant does a very good job at compressing my images (especially illustration artwork and screenshots, not so good on real photos). Even fake alpha transparency is often retained, so often you can't tell which one is the optimized version and which one the original if you don't look at the file size.
However, when I upload them to Serendipity and generate thumbnails from them, these are again full-blown 32-bit PNGs (or at least 24-bit) resulting in a file size often larger than the original image.
My suggestion would be to check the avilability of pngquant and use it to optimize thumbnails which are generated from 8-bit source files, so they keep their optimization.
32-bit and 24-bit PNG thumbnails could also be optimized with a tool for lossless optimization such as pngrewrite, pngout or pngcrush.
Similar optimizations could be done for JPEGs with jpegoptim.
What do you think?
Feature suggestion: optimizing thumbnails
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Feature suggestion: optimizing thumbnails
Hi!
I think the performance penalties of checking for pngquant should not be too hard, since the process is only called when optimizing images.
So yes, I think we could implement such a patch. Do you want to issue a Git pull request and provide a patch?
Best regards,
Garvin
I think the performance penalties of checking for pngquant should not be too hard, since the process is only called when optimizing images.
So yes, I think we could implement such a patch. Do you want to issue a Git pull request and provide a patch?
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: Feature suggestion: optimizing thumbnails
I guess I can do that. Although I haven't been too much into the s9y code.
My blog: Refining Linux
Re: Feature suggestion: optimizing thumbnails
BTW In order to be able to determine the color-depth of the image file I have to use some third-party function like this: https://github.com/ktomk/Miscellaneous/ ... geinfo.php
It is a libary for inspecting PNG files for things like color depth, color type etc. It consists of 54 lines of code (including comments and white space). Do you think it would be okay to include this function into the s9y core?
I guess the licenses should be compatible (s9y: BSD, lib: Apache 2.0)
It is a libary for inspecting PNG files for things like color depth, color type etc. It consists of 54 lines of code (including comments and white space). Do you think it would be okay to include this function into the s9y core?
I guess the licenses should be compatible (s9y: BSD, lib: Apache 2.0)
My blog: Refining Linux
Re: Feature suggestion: optimizing thumbnails
Or jpegtran.Manko10 wrote:Similar optimizations could be done for JPEGs with jpegoptim.
YL
Re: Feature suggestion: optimizing thumbnails
I just wanted to start writing the patch, but I'm not so sure what the best way is to determine the paths of pnquant, pncrush and jpegoptim. I could just issue the commands, but, I'm hesitating to do that because I can't know which command I really call. It could also do something else if the user wrote a shell script with that name, e.g.
Just using executables in /usr/bin/ is also not a great way because such tools hardly ever exist in /usr/bin. Most often they are somewhere in the user's home directory.
The only good option I see is adding an option to the backend:
Do you think, there's a better way to do this?
Just using executables in /usr/bin/ is also not a great way because such tools hardly ever exist in /usr/bin. Most often they are somewhere in the user's home directory.
The only good option I see is adding an option to the backend:
Code: Select all
[✓] Optimize thumbnails?
Path to pngquant: [foo]
Path to pncrush: [bar]
Path to jpegoptim: [baz]
My blog: Refining Linux
Re: Feature suggestion: optimizing thumbnails
But if they are, the user should set his $PATH properly to include them.Manko10 wrote:Most often they are somewhere in the user's home directory.
I'm wondering how many users actually have these installed on a webserver …
YL
Re: Feature suggestion: optimizing thumbnails
This will hardly be pre-installed on any server, but if it's a feature of s9y, the user is free to install it on his webspace.
Another advantage would be that also users who can't modify the PATH variable can use this feature because they only need to have the binaries in some arbitrary place on their webspace.
Of course, but perhaps he did, not knowing that s9y uses the same command. But if we let the user choose the file name we can be pretty sure that he knows about this.But if they are, the user should set his $PATH properly to include them.
Another advantage would be that also users who can't modify the PATH variable can use this feature because they only need to have the binaries in some arbitrary place on their webspace.
My blog: Refining Linux