Page 1 of 1

problem running affine example

Posted: 2013-05-14T20:49:00-07:00
by futuremoose
Hi,

I'm trying to run the example shown here (running Windows, IM 6.7.9 Q16):
http://www.imagemagick.org/Usage/distorts/#shadow3d

It's fairly simple... the first "convert" statement creates a blue letter "A" in the image and saves it.

Code: Select all

convert -background None -virtual-pixel Transparent -fill DodgerBlue -pointsize 72 -font Arial  label:A -trim +repage -gravity South -chop 0x5  standing_shape.png
The second line, however, is supposed to create a shadow.

Code: Select all

convert standing_shape.png -flip +distort SRT '0,0 1,-1 0' ( +clone -background Black -shadow 60x5+0+0 -virtual-pixel Transparent +distort Affine '0,0 0,0  100,0 100,0  0,100 100,50') +swap -background white -layers merge -fuzz 2% -trim +repage standing_shadow.jpg
That is not working... I keep getting the following error messages. It is trying to read part of the input as a file, like so:

Code: Select all

convert.exe: unable to open image `1,-1': No such file or directory @ error/blob
.c/OpenBlob/2641.
convert.exe: no decode delegate for this image format `1,-1' @ error/constitute.
c/ReadImage/544.
convert.exe: unable to open image `0'': No such file or directory @ error/blob.c
/OpenBlob/2641.
convert.exe: no decode delegate for this image format `0'' @ error/constitute.c/
ReadImage/544
The same error keeps repeating for the rest of the convert statement.

I copied this straight from the URL noted above, but do I need to change the syntax slightly for Windows?

Re: problem running affine example

Posted: 2013-05-14T20:56:29-07:00
by fmw42
convert standing_shape.png -flip +distort SRT '0,0 1,-1 0' ( +clone -background Black -shadow 60x5+0+0 -virtual-pixel Transparent +distort Affine '0,0 0,0 100,0 100,0 0,100 100,50') +swap -background white -layers merge -fuzz 2% -trim +repage standing_shadow.jpg
Be sure that you have space after the first parenthesis and before the last parenthesis. See red parenthesis in the above command

See the notes is small print on Anthony's page at http://www.imagemagick.org/Usage/basics/#parenthesis

Re: problem running affine example

Posted: 2013-05-14T21:31:13-07:00
by GreenKoopa
Also for Windows:

Try replacing single quotes with double quotes.
' => "

When in a batch file, remember to escape percents.
% => %%

Re: problem running affine example

Posted: 2013-05-14T23:53:52-07:00
by anthony
See IM examples, Windows DOS scripting
Converting Scripts: UNIX Shell to Window DOS
http://www.imagemagick.org/Usage/windows/#conversion

Re: problem running affine example

Posted: 2013-05-16T17:29:54-07:00
by futuremoose
Hello,

Thanks to all for replying. FMW42, your note about the space just before the parenthesis cleared up the issue of trying to read the numbers as an input file.

I also replaced the single quotes with doubles and escaped the "%" sign as "%%", as GreenKoopa suggested, for good measure.

It appears that has fixed the syntax, but now I get a new error:

Code: Select all

convert: unrecognized option `+distort'.
However, this page http://www.imagemagick.org/script/convert.php does list "distort" as a valid option for "convert". Any idea why it would not recognize "+distort" as an option? (I get the same error if I try using "-distort")

The full batch file now looks like

Code: Select all

convert -background None -virtual-pixel Transparent -fill DodgerBlue -pointsize 72 -font Arial  label:A -trim 

+repage -gravity South -chop 0x5  standing_shape.png

convert standing_shape.png -flip +distort SRT "0,0 1,-1 0" ( +clone -background Black -shadow 60x5+0+0 -virtual

-pixel Transparent +distort Affine "0,0 0,0  100,0 100,0  0,100 100,50" ) +swap -background white -layers merge 

-fuzz 2%% -trim +repage standing_shadow.jpg
Thanks again for your help and suggestions so far.

Re: problem running affine example

Posted: 2013-05-16T19:20:14-07:00
by GreenKoopa
-distort is commonly used and your commands appear reasonable. I don't see any line continuation ^ so I'm assuming this is was originally on one line. Double check that and your spacing. Is standing_shape.png getting generated correctly?