Skip to content

add quality_truecolor parameter #65

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

Merged
merged 1 commit into from
Jan 19, 2017

Conversation

xzdshr
Copy link

@xzdshr xzdshr commented Jan 17, 2017

Added new optional quality parameter, that allows to significantly reduce png file size.
By default this library converts palettized png files into truecolor images.
You can set $quality_truecolor to "false" to avoid convertation.

NOTE: palettized images have lesser quality! Because of this and for BC default value for $quality_truecolor is "true".

Test results for ~20000 images with different sizes and palettes:
Original folder size: 2GB
Resized folder without new parameter: 9,3GB (0 compression), 4GB (7 compression)
Resized folder with new parameter: 3,2GB (0 compression), 1,5GB (7 compression)

@adityapatadia
Copy link
Contributor

adityapatadia commented Jan 18, 2017

This is amazing. Can you do the same for all other image types too? I think JPG and GIF will benefit from same improvements.

@xzdshr
Copy link
Author

xzdshr commented Jan 19, 2017

JPG is always truecolor, and GIF is palette-based.
So this feature is for PNG only.

PS. Although the GIF format is almost never used for True Color images, it is possible to do so. But imagegif() uses GIF87a/GIF89a format, which allow only 256 colors (8-bit palette). Truecolor is 24-bit.

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

Successfully merging this pull request may close these issues.

2 participants