Aalok_G
Aalok_G

Reputation: 501

Image Magick error in Unix : non-conforming drawing primitive definition `circle'

convert -quiet 2B_IMAGES/1001005_2_53990/01_03DEC22_S01005_0004_cutout_1209.fits 
-level 4.92401123047%,5.47628846705% -negate -fill transparent -stroke green 
-draw "circle $X,$Y `echo $X+5|bc`,$Y" -stroke black 
-draw "rectangle `echo $X-12|bc`,`echo $Y-12|bc` `echo $X+12|bc`,`echo $Y+12|bc`" 
-crop 50x50+`echo $X-25|bc`+`echo $Y-25|bc`\! -background transparent 
-flatten +repage 2B_IMAGES/1001005_2_53990/out.png;

The above script works perfectly in macOSX. But when I try to run this on a unix server, I get the following errors:

convert.bin: non-conforming drawing primitive definition circle' @ error/draw.c/DrawImage/3158. convert.bin: unable to open image'106.727','64.344'': No such file or directory @ error/blob.c/OpenBlob/2638. convert.bin: no decode delegate for this image format '106.727','64.344'' @ error/constitute.c/ReadImage/544. convert.bin: unable to open image111.727,'64.344'': No such file or directory @ error/blob.c/OpenBlob/2638. convert.bin: no decode delegate for this image format 111.727,'64.344'' @ error/constitute.c/ReadImage/544. convert.bin: non-conforming drawing primitive definitioncircle' @ error/draw.c/DrawImage/3158. convert.bin: non-conforming drawing primitive definition rectangle' @ error/draw.c/DrawImage/3158. convert.bin: unable to open image94.727,52.344': No such file or directory @ error/blob.c/OpenBlob/2638. convert.bin: no decode delegate for this image format 94.727,52.344' @ error/constitute.c/ReadImage/544. convert.bin: unable to open image118.727,76.344': No such file or directory @ error/blob.c/OpenBlob/2638. convert.bin: no decode delegate for this image format 118.727,76.344' @ error/constitute.c/ReadImage/544. convert.bin: non-conforming drawing primitive definitioncircle' @ error/draw.c/DrawImage/3158. convert.bin: non-conforming drawing primitive definition `rectangle' @ error/draw.c/DrawImage/3158.

In the script, the variables X and Y contain the location of the centre about which I want to draw a circle and rectangle. In the above case X=106.727 and Y=64.344. The path to the input image is : '2B_IMAGES/1001005_2_53990/01_03DEC22_S01005_0004_cutout_1209.fits' and the output path is 2B_IMAGES/1001005_2_53990/out.png

I tried finding answers online, but wasn't able to resolve the problem. I'm still getting the same errors. Can someone please suggest me the changes I need to make in the script to make it work.

Upvotes: 0

Views: 1376

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207475

I would recommend converting $x and $Y to integers near the top of the script, before calling draw, like this:

# Round $X to nearest int
X=$(echo "($X+0.5)/1" | bc)

# Round Y to nearest int
Y=$(echo "($Y+0.5)/1" | bc)

Further, check you have support for FITS images with

identify -list format | grep -Ei "fit|Flex"

Upvotes: 0

Related Questions