0

I have an imagemagick command that is having trouble with the $quote$arcangle and $halfdimension$quote concatenated shell variables I'm passing as strings. Here's the transcript:

$> echo convert grad.png -alpha set -virtual-pixel Transparent -rotate 180 -distort Arc $quote$arcangle -90 $halfdimension$quote +repage -gravity center -crop $dimension"x"$dimension"+0+0" +repage h.png
   convert grad.png -alpha set -virtual-pixel Transparent -rotate 180 -distort Arc '360 -90 450' +repage -gravity center -crop 900x900+0+0 +repage h.png

$> convert grad.png -alpha set -virtual-pixel Transparent -rotate 180 -distort Arc $quote$arcangle -90 $halfdimension$quote +repage -gravity center -crop $dimension"x"$dimension"+0+0" +repage h.png
convert: unable to open image `-90': No such file or directory @ error/blob.c/OpenBlob/2709.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.
convert: unable to open image `450'': No such file or directory @ error/blob.c/OpenBlob/2709.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.

Yet, I paste in the output of the echoed command:

$> convert grad.png -alpha set -virtual-pixel Transparent -rotate 180 -distort Arc '360 -90 450' +repage -gravity center -crop 900x900+0+0 +repage h.png
(h.png is created without problems.)

Why is it not getting parsed correctly in the first instance?

Escher
  • 523

1 Answers1

2

Maybe this will work, write this to the file foo.sh:

#!/bin/bash
arcangle=270
dimension=768
fin=grad.png
fout=h.png
convert $fin -alpha set -virtual-pixel Transparent -rotate 180 -distort Arc "$arcangle -90" +repage -gravity center -crop "${dimension}x${dimension}+0+0" +repage $fout

and ./foo.sh

see also here

t-bltg
  • 275