Tuesday 22 November 2011 9:11:23 pm - 4 replies
I believe I have found an improvement for creating images with rounded corners. Although various methods for doing this are discussed on these forums, there are various drawbacks, such as the need to use an image mask, or having to apply the filter to all images.
The approach documented below uses only an ImageMagick filter specified in image.ini.append.php, and does not need an image mask file. It also adjusts to different image sizes automatically, even to rectangular sizes (though it has a fixed corner radius size which you can specify). Because it's a filter, you can use it on any image alias you like.
Its main downside appears to be that it can only output PNG images-- but I prefer PNG anyways, especially for images this small. And in many cases, with rounded corners you want the transparency that PNG provides.
Wednesday 23 November 2011 1:55:52 pm
Great work, I did the same some time ago, but instead of hardcoding 5 in e.g. "...white circle 5,5 5,0" I did "...white circle %1,%1 %1,0" and called my filter with something like this:
Filters[]=corner/rounded=10
The MimeType Setting was new for me tho. Thank you!
Wednesday 23 November 2011 2:46:25 pm
Great work, I did the same some time ago, but instead of hardcoding 5 in e.g. "...white circle 5,5 5,0" I did "...white circle %1,%1 %1,0" and called my filter with something like this:
Filters[]=corner/rounded=10
Good, thanks for the improvement! I'm still new to all this and did not know about this syntax.
The MimeType Setting was new for me tho.
Did you get it to work with JPEG? I couldn't get it to work, but I imagine if one knew a bit more ImageMagick one could substitute white for the transparency that is used on the corners. It doesn't matter in my case because I wanted PNG anyways, so it was nice that just adding the MIMEType line converted and also made the transparent corners work. I was afraid it would apply the conversion at the end, after the filters, but it appears to apply it before the filters; or else, the filters are applied first but alpha information is simply lost if you do not save as PNG.
Modified on Wednesday 23 November 2011 2:50:58 pm by A Fowler
You must be logged in to post messages in this topic!