problem running affine example

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?".
Post Reply
futuremoose
Posts: 5
Joined: 2012-09-18T19:10:00-07:00
Authentication code: 67789

problem running affine example

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: problem running affine example

Post 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
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: problem running affine example

Post by GreenKoopa »

Also for Windows:

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

When in a batch file, remember to escape percents.
% => %%
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: problem running affine example

Post by anthony »

See IM examples, Windows DOS scripting
Converting Scripts: UNIX Shell to Window DOS
http://www.imagemagick.org/Usage/windows/#conversion
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
futuremoose
Posts: 5
Joined: 2012-09-18T19:10:00-07:00
Authentication code: 67789

Re: problem running affine example

Post 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.
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: problem running affine example

Post 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?
Post Reply