Jump to content

IMagick Image Sizer quality question


SamC
 Share

Recommended Posts

I'm going to use the IMagick Image Sizer engine which I just installed.

59fd8da43dbe3_ScreenShot2017-11-04at09_51_10.thumb.png.13fe451c5e02961144df8650dce8dbe2.png

Does the quality here override the quality I set on the front end for image resizing? Let's say it's different:

$options = array("quality" => 90, "cropping" => "center");

What is the resulting quality of the image '$thumb'?

$thumb = $entry->postThumbnail->size(800, 450, $options);

Finding this a bit confusing. Thanks for any advice.

==EDIT==

After reading around a few posts, I notice you can set defaults in config.php.

So if I:

/**
 *
 * Global image sizing options
 *
 */
$config->imageSizerOptions = array("upscaling" => true, "cropping" => "center", "quality" => 90));

...then use imagemagick, and set the quality of that to 85, will the cropping center options be applied to images? I read PW will use IMagick if present, then GD as a fallback i.e. do the array above apply only to the fallback?

Link to comment
Share on other sites

It is hirarchically ordered, highest first:

  1. $element->size() options are the highest, overrides all other
     
  2. individual ImageEngine-Settings, override all below them,
    if you have installed two or more engines, only the setting of the finally invoked engine is used
     
  3. site/config.php => $config->imageSizerOptions
     
  4. wire/config.php => $config->imageSizerOptions
     
  5. and last, but more theoretically, if all above would be missing, the hardcoded defaults of the module-file (php-class) would be used


The higher override all lower

  • Like 1
Link to comment
Share on other sites

20 minutes ago, horst said:

It is hirarchically ordered, highest first:

  1. $element->size() options are the highest, overrides all other
     
  2. individual ImageEngine-Settings, override all below them,
    if you have installed two or more engines, only the setting of the finally invoked engine is used
     
  3. site/config.php => $config->imageSizerOptions
     
  4. wire/config.php => $config->imageSizerOptions
     
  5. and last, but more theoretically, if all above would be missing, the hardcoded defaults of the module-file (php-class) would be used


The higher override all lower

Thanks @horst still not 100% here. For number 2, imagemagick doesn't have a crop setting so that is set in number 3. How does the crop happen in this case?

Link to comment
Share on other sites

So, I've got:

// config.php
/**
 *
 * Global image sizing options
 *
 */
$config->custImages = array("upscaling" => true, 'cropping' => "center", "quality" => 90);
// _init.php
$imgOptions = $config->custImages;
// card.php
<?php
  if ($entry->postThumbnail):
    $thumb = $entry->postThumbnail->size(800, 450, $imgOptions);
?>

Imagemagick is installed. So, does this mean the cropping will be applied? Will imagemagick even be used in this case, or GD? This is what's confusing me.

= EDIT =

Correct me if I'm wrong but everything seems to work now. Images are being cropped, and FAST! Where has imagemagick been all my life?? :)

Link to comment
Share on other sites

When ImageSizerEngineIMagick is installed, the settings defined in the module config screen for quality and sharpening apply and any settings for these in $config->imageSizerOptions are overridden.

See discussion here:

I'm not a fan of this and would prefer to have quality and sharpening defined in $config->imageSizerOptions.

Edited by Robin S
Edit: quoted wrong part of original post. You can set quality and sharpening in individual image sizer operation with the $options argument.
  • Like 2
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...