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

Big filesize with png images #15

Open
ghost opened this issue Oct 31, 2017 · 4 comments
Open

Big filesize with png images #15

ghost opened this issue Oct 31, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Oct 31, 2017

Hello,

I noticed that png images have an anormal big size when resized with this plugin.

For example that dummy resized png image have a file size of 13KB. If I use optipng on it, the file size is 4KB without noticeable quality loss.

It's a shame that a plugin made to optimize images for mobile devices generate so big image size, can it be improved ? I noticed that the Image resizer plugin have an option to optimize png image using Tiny PNG service, maybe that was to resolve the same problematic...

What do you think about that ?

thumb__550x400_0_0_crop__300

Best regards,

Alex

@tobias-kuendig
Copy link
Member

Maybe this is the same problem reported here:
octobercms/october#2644

The plugin uses the october cms native image resizer. Which build are you running?
Does it help if you pass a lower quality than the default of 90 on this line:

$this->resizer->resize($size, null, ['quality' => 80])->save($this->getStoragePath($size));

@ghost
Copy link
Author

ghost commented Oct 31, 2017

Tried to set a quality of 80, then 60 without seeing noticeable change to the filesize. I could obtain a decent filesize with a quality of 10, but with big quality loss.

@ghost
Copy link
Author

ghost commented Oct 31, 2017

Here is some sample to see the problem.

  • The dummy.png file is the original file (1000 x 1000px) with a size of 5.13KB
  • The thumb__550x400_0_0_crop__500.png is a cropped image by october (500 x 363px) with a file size of 35KB
  • thumb__550x400_0_0_crop__500_optipng.png is that same cropped image (500 x 363px) but optimized with optipng with a file size of 10.9KB

The first strange thing you can notice is that cropped images are heavier than the original one, even the optipng version.

But the import thing to notice is that the october cropped image have a file size of 35KB, for a 500 x 363px image mainly based on 1 color, this is not an acceptable size.

Not sure this is only a "quality" setting because I tested the Image resizer plugin that provide a setting to change the quality, but, except if I put 10 to quality to obtain a very bad image quality, I can't have a decent file size.

But even if there is a "deeper problem" it would be great to add a quality settings to that plugin in order to have a little more control on file size.

dummy
thumb__550x400_0_0_crop__500
thumb__550x400_0_0_crop__500_optipng

@obuchmann
Copy link
Contributor

This Plugin provides different images for different screen sizes. It does not change the quality.

My Advice: Use ImageResizer Plugin to compress the images to a maximum size and quality. And send it to this plugin afterwards.

https://octobercms.com/plugin/toughdeveloper-imageresizer

Next advice, if you want to decrease file size in exchange for quality: Use a compressed image format like jpeg.

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