If you compare this to how you use the filter in an image alias ( geometry/scale=75 75), you can see how its usage maps to its definition. To understand how to do that, let's look up the filter definition for "geometry/scale" in eZ Publish's base image.ini: Once you have a suitable version of ImageMagick, you can set up a custom image filter definition. Or, if you're on CentOS with the "remi" packages, you can install the package "ImageMagick2".) (If you have an older version of ImageMagick, you can compile it from the source here. So you'll get a 103x75 or 75x103 image using the aspect ratio in the previous example, and that can then be cropped. In ImageMagick 6.3.8-2 (released in January 2008) or higher, there is a ^ flag that performs the resizing based on the smaller dimension. Another workaround is to test which dimension is the bigger one before resizing, but this is quite an involved hack. However, this means that you are guaranteed to have to crop more of the image than necessary. There are a couple of workarounds: one is to resize the image to dimensions that you know will be bigger than the square before cropping. ![]() This is because the default ImageMagick "scale" filter does its resizing based on which dimension is bigger. However, unless your original image is already a perfect square, with the alias defined above, you will end up with images with dimensions such as 75x55 or 55x75. Here, you can resize the image, and then crop it. Suppose you want to resize images to fit a 75x75 square. However, it gets tricky when you want to resize images to fix exact width and height dimensions. Alias examples such as the one above work very well for this. In most cases, you have one limiting dimension - either the size or the width. as well as the definition of the alias in its own block: įilters=geometry/scale=75 75 Exact image sizing Most new image aliases involve a new entry in the AliasList array in the AliasSettings block. This is actually best documented inline in the base image.ini. ![]() image.iniįor those who are familiar with eZ Publish, by now you know how simple it is to define custom image size aliases in an override of image.ini. In this article, we'll show you how to make use of a custom ImageMagick filter to achieve exact image sizes. ![]() EZ Publish comes with a useful set of image settings, and has a powerful framework within which you can define custom filters to be executed by the image handler.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |