Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
I need to do a circle crop on an image with a gradient.
Reason: I'm doing HDR panoramashots with a Sigma 8mm fisheye. And sometimes I have internal reflections of the lense in the image - namely outside the 180° field of view (see image).
Unfortunately the controlpoint detectors will gladly jump on those artifacts which makes automatic processing difficult.
So I decided to crop those images with ($1 = input image, $2 = output image)
I do not see your harsh stair stepping (in the zoomed image) in my result when I use IM 6.8.7.0 Q16 Mac OSX with
convert -size 320x213 xc:black -fill white \
-draw "translate 160,106.5 circle 0,0 0,106.5" -alpha off result
I think you have two problems:
1) your calculations of center are only to integer precision when you use expr. Use bc instead or IM fx calculations to get floating point precision.
2) I suspect your IM version may have a bug and is not anti-aliasing the -draw command. You never answered what version and platform you are using (or I missed it).
If you want to antialias further
convert -size 320x213 xc:black -fill white \
-draw "translate 160,106.5 circle 0,0 0,106.5" -alpha off -virtual-pixel black -blur 1x65000 -level 50x100% result.png
You can change the radius of the blur from 1 to some larger value if needed.
Last edited by fmw42 on 2013-09-27T21:16:16-07:00, edited 2 times in total.
Looking at your script and taking values from it, I tried to reproduce your full resolution results in IM 6.8.7.0 Q16 Mac OSX. My results do not show the extreme stair-stepping. So again I think your anti-aliasing is not working correctly.
The first is your script condensed (and with floating point calculations). The second is creating a separate mask and putting the mask in the alpha channel. The third is the same as the second, but I further anti-alias by using -blur ... -level ... And again you can increase the radius of the blur from 1 if you want more anti-aliasing.
fmw42 wrote:
2) I suspect your IM version may have a bug and is not anti-aliasing the -draw command. You never answered what version and platform you are using (or I missed it).
If you want to antialias further
convert -size 320x213 xc:black -fill white \
-draw "translate 160,106.5 circle 0,0 0,106.5" -alpha off -virtual-pixel black -blur 1x65000 -level 50x100% result.png
fmw42 wrote:Looking at your script and taking values from it, I tried to reproduce your full resolution results in IM 6.8.7.0 Q16 Mac OSX. My results do not show the extreme stair-stepping. So again I think your anti-aliasing is not working correctly.
Gna.. The problem is, that you're working with some transparency-tricks and PNG as output format. This doesn't work with JPG, which is a requirement for me.
While they both have the same result using 'over composition' onto the the background color, the -alpha remove does not create a second 'background image' to compose against, but does the pixel composition pixel by pixel more directly. It also does not 'merge' multiple images as -layers flatten (what -flatten is an short name, historical alias for) does.