title: Rounded corners with Paperclip
body: <p>How do you create rounded corners with Paperclip? I have found this solution which creates <a href="http://loo.no/2009/08/09/rounded-corners-with-paperclip" rel="nofollow">rounded corners with paperclip using convert_options</a>, but it does not work with Rails 3 and Paperclip 2.4.5. The generated convert command works only if I use the <a href="http://www.imagemagick.org/Usage/thumbnails/#rounded" rel="nofollow">ImageMagick alpha parameter</a> instead of the threshold paramter: </p>
  
  <pre><code>  convert example.jpg \
       \( +clone  -alpha extract \
          -draw 'fill black polygon 0,0 0,15 15,0 fill white circle 15,15 15,0' \
          \( +clone -flip \) -compose Multiply -composite \
          \( +clone -flop \) -compose Multiply -composite \
       \) -alpha off -compose CopyOpacity -composite  rounded_corners.png
  </code></pre>
  
  <p>which corresponds to</p>
  
  <pre><code>has_attached_file :avatar,
                    :styles =&gt; { :medium =&gt; ["918x483#", :png] },
                    :convert_options =&gt; {:medium =&gt; Proc.new{self.convert_options}}
  
  def self.convert_options(px = 15)
    trans = ""
    trans &lt;&lt; " \\( +clone  -alpha extract "
    trans &lt;&lt; "-draw 'fill black polygon 0,0 0,#{px} #{px},0 fill white circle #{px},#{px} #{px},0' "
    trans &lt;&lt; "\\( +clone -flip \\) -compose Multiply -composite "
    trans &lt;&lt; "\\( +clone -flop \\) -compose Multiply -composite "
    trans &lt;&lt; "\\) +alpha off -compose CopyOpacity -composite "
  end
  </code></pre>
  
  <p>This code snippet seems to produce the right convert command, but gives an "<strong>error processing the thumbnail for stream-xyz</strong>".</p>
  
  <pre><code>Command :: convert '/tmp/stream20120109-15817-1lju7p6-0.jpg[0]' -resize "918x" 
    -crop "918x483+0+105" +repage \( +clone -alpha extract -draw 'fill black polygon 
    0,0 0,15 15,0 fill white circle 15,15 15,0' \( +clone -flip \) -compose 
    Multiply -composite \( +clone -flop \) -compose Multiply -composite \) +alpha off
    -compose CopyOpacity -composite '/tmp/stream20120109-15817-1lju7p6-....png'
  [paperclip] An error was received while processing: #&lt;Paperclip::PaperclipError: 
  There was an error processing the thumbnail for stream20120109-15817-1lju7p6-0&gt;
  </code></pre>