Hello, I had issue for optimize png with pngquant. After some recherche, I have find that if I simplify the "exec" command inside the function "imageapi_optimize_binaries_pngquant", the optimization works better...
So, that patch is for everybody who get some no optimized image with pngquant.
Info : pngquant 2.0.1 on Ubuntu 12.04 LTS installed with :
sudo add-apt-repository ppa:danmbox/ppa
sudo apt-get update
sudo apt-get install pngquant
Comments
Comment #1
steveoriolComment #2
garphyYour patch simply allows pngquant to compress more by setting no limit on the quality.
What would be great is to be able to set up the --quality setting within the UI as provided by some other integrated tools.
Comment #3
joelpittet+1 to @garphy's comment #2. Would be nice to have this configurable.
Comment #4
christophweber commentedAgree with @garphy and @joelpittet. This patch is making assumptions which should be under end user control, hopefully with some help to make them understand the consequences.
Comment #5
attisanI'm not yet done - but in case anyone needs settings for pngquant + (what is more) an option to 'force rewrite' images with wrong extentions (as is the case when jpgs are converted to pngs).
I will try to finish my work within the next weeks.
hth
Comment #6
nikolay shapovalov commented1) Can't apply patch, use path from root of the module.
2) trailing whitespace (line 97 of patch)
Comment #7
attisanoooh gosh :-( - I'm sorry.
Comment #8
jethro commentedThanks
I needed to change the quality for pngquant to get better compression as well and this was useful.
One change I might make is splitting the quality settings into two separate integer fields for a min and a max as the current textfield seems like something that someone could enter bad data and/or forget the correct format easily. An example in the description might be enough.
Comment #9
steven jones commentedMoving to the latest module version queue.
Lets tidy this patch up and get it in.
Comment #10
mschudders commentedDrupal 8 patch attached.
Comment #11
svdhout commentedI can confirm that the patch in #10 works on 8.5.x
Comment #12
steven jones commentedComment #13
tim-dielsAfter splitting the modules in separate modules, the patch does not apply anymore. Rerolled the patch against correct module.
Comment #14
borisson_There are a couple of coding standards issues in the latest patch, the indentation is incorrect.
Comment #15
tim-dielsRe-rolled because of CS.
Comment #16
tim-dielsComment #17
borisson_Awesome, let's get this in!
Comment #18
steven jones commentedThanks for the patches and reviews all!
I think there's still some things we could do here before we get this in. Nothing too major I don't think.
From what I understand we are aiming to optimise the image 'in place'. So we really do want to overwrite the existing file passed into the processor.
Allowing the file extension that pngquant is going to output might mean that a misconfiguration would stop the optimization processing from working correctly.
What's the reasoning for allowing this option to be customised?
I think we need to specify
'#empty_value' => ''otherwise once you've selected a value, there's no way to go back to not specifying one. Or we should change the default value to 3 to match pngquant.Also, https://www.mankier.com/1/pngquant#Synopsis suggests that the max should be 11?
Our default is 1, not 3. Can we provide some better help text here or a change a default somewhere please?
I think we should split this into two 'number' elements please. This will give us some validation too, if we correctly specify '#min' and '#max'.
A range slider with two handles might be better, but harder to make work cross-browser I think.
Is this bit of the comment required? Do I need to worry about exit codes when picking a number here?
Should this say something along the lines of: if pngquant can't produce a good enough quality image then the original image will be left unchanged?
I don't think it makes sense to allow this to be customised, so I think we can removed this form element.
I think we need to add some validation to the form, especially for the quality element. If we switch to using two number elements then we should only need to verify that min < max.
Comment #19
steven jones commentedComment #21
steven jones commentedThanks for the patches, reviews and patience everyone! This is now in 8.x-1.x.
Comment #22
steven jones commentedComment #24
gaurav_manerkar commentedI have created a patch with file extension option for pngQuant
This patch is for 8.x-1.0-alpha2 version of module.