Page 1 of 1
IM7 -script option usage
Posted: 2015-12-26T14:48:14-07:00
by aperly
Hi. I've got an issue with ImageMagick 7.0.0-0 Q16 x64 2015-12-20 (win64-portable).
This works well:
However, when I try:
Code: Select all
echo -size 42x42 xc:red t.png | magick -script -
IM gives me the following errors:
magick: UnableToOpenBlob 't.png': No such file or directory @ error/blob.c/OpenBlob/2692.
magick: UnableToOpenFile `t.png' @ error/png.c/ReadPNGImage/3974.
It looks like everything is considered as an input. I want to specify my output here.
What am I doing wrong? Thank!
Re: IM7 -script option usage
Posted: 2015-12-26T17:58:11-07:00
by magick
Try this instead:
- echo -size 42x42 xc:red -write t.png | magick -script -
Re: IM7 -script option usage
Posted: 2015-12-26T18:04:21-07:00
by fmw42
I do not think you can put input or output files in the script.
I tried this with no errors, but the image was not created.
Code: Select all
echo "-size 42x42 xc:red" | magick -verbose -script - t.png
Same result putting -size 42x42 xc:red in a file (script.txt) and doing
Code: Select all
magick -verbose -script script.txt t.png
No image was created. I was using IM 7 from Dec 26, 2015.
Re: IM7 -script option usage
Posted: 2015-12-26T18:08:12-07:00
by aperly
magick wrote:Try this instead:
- echo -size 42x42 xc:red -write t.png | magick -script -
Perfect! Thanks again.
Now I can write
very long commands easily.
PS: Was is documented somewhere? I cannot find any reference to it.
Re: IM7 -script option usage
Posted: 2015-12-26T18:17:15-07:00
by fmw42
Did you get an output. I did not on Mac OSX with my commands above (without the -write)?
There is a short document, but right now I cannot find it either.
I would suggest you put the echo text into quotes also.
I do not understand the benefit of using echo rather than just putting the text into the command itself. If you have a long command and want to save it, I would put it into a text file.
Re: IM7 -script option usage
Posted: 2015-12-26T18:19:11-07:00
by fmw42
Magick:
Why don't either of these work? I get no error and no output!
Code: Select all
echo "-size 42x42 xc:red" | magick -verbose -script - t.png
Code: Select all
magick -verbose -script script.txt t.png
Is there a +script so that one could do:
Code: Select all
magick -verbose -script script.txt +script t.png
This still does not produce an output.
Re: IM7 -script option usage
Posted: 2015-12-26T18:25:40-07:00
by aperly
fmw42 wrote:Did you get an output. I did not on Mac OSX with my commands above (without the -write)?
Code: Select all
echo "-size 42x42 xc:red" | magick -verbose -script - t.png
magick: UnrecognizedOption `-size 42x42 xc:red' in "stdin" at line 1,column 1 @ fatal/magick-cli.c/ProcessScriptOptions/190.
[Windows shell behaviour?]
---
Code: Select all
echo -size 42x42 xc:red | magick -verbose -script - t.png
xc:red=>red XC 42x42 42x42+0+0 16-bit sRGB 0.000u 0:00.000
No t.png created.
---
Code: Select all
magick -verbose -script script.txt t.png
xc:red=>red XC 42x42 42x42+0+0 16-bit sRGB 0.000u 0:00.000
No t.png created.
---
Magick's '-write' works well.
PS:
I do not understand the benefit of using echo rather than just putting the text into the command itself. If you have a long command and want to save it, I would put it into a text file.
Yeah, that was just for the test case. Easier to put a on-liner on the forum. I'm feeding 100kB commands now.
Re: IM7 -script option usage
Posted: 2015-12-26T18:33:11-07:00
by fmw42
Glad to hear that the -write works. I suppose it has to do with the -script stopping reading from the command line. But it would seem that one should have a +script to start back reading from the command line so that this might work.
Code: Select all
echo "-size 42x42 xc:red" | magick -verbose -script - +script t.png
Re: IM7 -script option usage
Posted: 2016-01-22T07:41:40-07:00
by aperly
Little update: I went as far as using 500MB scripts and it worked fine (for real usage, not just for stress-testing). I guess it's quite robust.