Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

I just read StackExchange blog It’s OK to Ask and Answer Your Own Questions which even encourages it and decided to ask about a problem I now know how to solve. But I found an elegant answer only recently (and will post it now below), much inspired by this very site and answers I'm trying to understand.

Q: I would like to round the corners of an image into circular arcs of some radius before I upload it to a blog.

Test image:

enter image description here

share|improve this question

marked as duplicate by Jens, Artes, J. M. Apr 5 '13 at 23:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

1 Answer 1

round[i_, r_] :=
 Module[{w, h},
  {w, h} = ImageDimensions@i;
  With[{
    f = Reverse,
    p = PadRight[DiskMatrix[r][[;; r, ;; r]], {h, w}, 1]},
   i~ImageAdd~ColorNegate@Image[p f /@ p f@p f[f /@ p]]]]

img = Import@"http://i.stack.imgur.com/f1gur.jpg";

img~round~20

finemanround

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.