开发者

Programmatically radius image

开发者 https://www.devze.com 2023-04-02 14:58 出处:网络
Currently our website department have a process where they manually radius the corners of each images to +4% to create \"nicer\" looking images for the 开发者_JAVA百科web.

Currently our website department have a process where they manually radius the corners of each images to +4% to create "nicer" looking images for the 开发者_JAVA百科web.

They currently do this using the radius function of Serif Photoplus, I was hoping people could think of a way to do this programmatically to a whole folder of images ideally using open source or free tools.

I'm aware we could do the radiusing with CSS, but I have yet to be convinced that there is an easy way to do this that is effective across all browsers and legacy browsers although I'm open to options in regard to this.


I think ImageMagick would be the right tool for the job.

This thread explains how to make rounded corners on images. It seems there are many ways to do this, this is why I listed no particular solution here. ImageMagick also has a batch function, with that you can apply the corner rounding to all the images in a directory.

ImageMagick is distributed under the Apache 2.0 license, so you can use it freely for commercial purposes.


You could do it by hand, creating a mask and then adding the images.

Example in Mathematica:

id = ImageDimensions; 
ImageAdd[#, 
   Rasterize[
    Graphics[Rectangle[{0, 0}, id@#, RoundingRadius -> Max@id@#/25], 
     PlotRange -> Transpose@{{0, 0}, id@#}],
   ImageSize -> id@#]] &@
 Import@"http://tutor-atlanta.com/wp-content/uploads/2010/11/test2.jpg"

Programmatically radius image

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号