Vikestart

Image resizing quality

Recommended Posts

What is up with the quality of images when they are resized? Is there anything that can be done to increase the quality?

Compare the two:

Original:

APieceOfTheRoad.jpg.926de80d94550822fb93b3e93da4d6cd.jpg

 

Resized (barely smaller):

apieceoftheroad.800x344.jpg.4d6f734b9294526e97f057d716e7e1f3.jpg

 

The quality loss is enormeous, especially in dark areas of the image.

Share this post


Link to post
Share on other sites
1 hour ago, Vikestart said:

What is up with the quality of images when they are resized?

What's up is that the size() method accepts a 'quality' setting in its $options array: https://processwire.com/api/ref/pageimage/size/

And you can define the default quality setting used for the image sizer in /site/config.php via $config->imageSizerOptions: https://processwire.com/api/ref/config/

  • Like 4

Share this post


Link to post
Share on other sites
18 minutes ago, Robin S said:

What's up is that the size() method accepts a 'quality' setting in its $options array: https://processwire.com/api/ref/pageimage/size/

And you can define the default quality setting used for the image sizer in /site/config.php via $config->imageSizerOptions: https://processwire.com/api/ref/config/

Oooh, I didn't even know about that config.php file and that list of settings you linked to is certainly useful. :)

Still getting to know Processwire. I'll just dive in and see where this gets me :) Thanks!

Share this post


Link to post
Share on other sites

By default PHP's bundled GD 2 library is used.

If you're using a recent ProcessWire 3 version, ImageMagick is also supported (if you can have it installed on your server of course).

Perhaps you could have better results.

https://processwire.com/blog/posts/processwire-3.0.10-expands-image-resize-options/

NB: in /wire/config.php you can also see some settings, copy them to /site/config.php and modify them...

Edited by Christophe
  • Like 4

Share this post


Link to post
Share on other sites

..., and you should enable the IMagick Imagesizer Engine if your server supports it! (under PW 3)

..., and additionally to the quality-value, you can try out differend sharpening values (none, soft, medium, strong)

  • Like 3

Share this post


Link to post
Share on other sites

Setting the defaultGamma option to 0.5 instead of the default 2.0 seems to have fixed the image quality.

$config->imageSizerOptions = array('upscaling' => true, 'cropping' => true, 'quality' => 100, 'sharpening' => 'none', 'defaultGamma' => 0.5);

Thanks for the help everyone! :D

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
On 4/6/2017 at 12:43 AM, Vikestart said:

Setting the defaultGamma option to 0.5 instead of the default 2.0 seems to have fixed the image quality.


$config->imageSizerOptions = array('upscaling' => true, 'cropping' => true, 'quality' => 100, 'sharpening' => 'none', 'defaultGamma' => 0.5);

Thanks for the help everyone! :D

@Vikestart

Did you paste this from your config in /wire/ to your config file in /site/ ?

Share this post


Link to post
Share on other sites

Have you also tried -1 ?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.