Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

round[i_, r_] :=
 Module[{w, h},
  {w, h} = ImageDimensions@i;
    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@"";



share|improve this answer

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