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?".
Is there, I am wondering, a way of piping the output of a command -
the 'fortune' command for example - to 'convert' in order to save the
output in png format ? I am currently piping to 'enscript' and then
passing the resultant image to 'convert'. I'd like to get rid of the
'enscript' step, if possible.
Here is an example of what I'm doing at the moment:
echo Merry Christmas | convert -font Arial -pointsize 72 -fill red -background green text:- -trim cap.png
The piped text is picked up by "text:-" and the rest sets up the font/size/colour and then trims the result.
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
@magick/Anthony
Although text:- reads the standard input, I can't get caption:- or label:- to do the same thing. Are they supposed to work or is this function limited to text:-?
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
@magick/Anthony
Although text:- reads the standard input, I can't get caption:- or label:- to do the same thing. Are they supposed to work or is this function limited to text:-?
Pete
Pete,
These work for me (IM 6.4.8-1 Q16):
echo "Merry Christmas" | convert -font Arial -pointsize 72 -fill red -background green \
text:- -trim tmp1.png
But you need @- for label: and caption:
echo "Merry Christmas" | convert -font Arial -pointsize 72 -fill red -background green \
label:@- -trim tmp2.png
echo "Merry Christmas" | convert -font Arial -pointsize 72 -fill red -background green \
-size 320x caption:@- -trim tmp3.png
Seems a bit inconsistent. But there must be some reason. Also, text:@- does not work.
convert: unable to read blob `-': No such file or directory @ blob.c/FileToBlob/868.
imconvert: missing an image filename `cap.png' @ convert.c/ConvertImageCommand/2710.
convert: geometry does not contain image `@-' @ statistic.c/GetImageBoundingBox/217.
imconvert: unable to read blob `-': No such file or directory @ blob.c/FileToBlob/868.
I don't understand the complaint about geometry. I can make the -size much larger than it needs and it still complains
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
convert: unable to read blob `-': No such file or directory @ blob.c/FileToBlob/868.
imconvert: missing an image filename `cap.png' @ convert.c/ConvertImageCommand/2710.
convert: geometry does not contain image `@-' @ statistic.c/GetImageBoundingBox/217.
imconvert: unable to read blob `-': No such file or directory @ blob.c/FileToBlob/868.
I don't understand the complaint about geometry. I can make the -size much larger than it needs and it still complains
Pete
Guess we need to hear from Magick or Anthony. Those work for me on Mac OSX Tiger (unix). So must be some special issue with @ on windows. Did you try escaping it, I assume ^@-
I tried all sorts of escapes and quoting and nothing works.
Pete.
Merry Christmas Fred and All
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
The '-' is a special filename meaning either read from standard input (piped input ot keyboard) or write to standard output (pipe to another command or to the screen).
text: reads from a file name so you use text:-
label: and caption: read a string. so you prepend '@' to have the string read from a filename EG: label:@-
convert: geometry does not contain image `@-' @ statistic.c/GetImageBoundingBox/217.
imconvert: unable to read blob `-': No such file or directory @ blob.c/FileToBlob/868.
I don't understand the complaint about geometry. I can make the -size much larger than it needs and it still complains
If you read IM Examples on text to image handling caption, the first thing is says is that caption: requires a -size setting to specify a image 'width' for the caption for word wrapping purposes. If you don't have it you get a geometry error as you saw.
>echo Merry Christmas | imconvert -font Arial -pointsize 72 -fill red -background green label:@- -trim cap_l.png
imconvert: unable to read blob `-': No such file or directory @ blob.c/FileToBlob/868.
imconvert: missing an image filename `cap_l.png' @ convert.c/ConvertImageCommand/2710
>echo Merry Christmas | imconvert -font Arial -pointsize 72 -fill red -background green label:^@- -trim cap_l.png
imconvert: unable to read blob `-': No such file or directory @ blob.c/FileToBlob/868.
imconvert: missing an image filename `cap_l.png' @ convert.c/ConvertImageCommand/2710.
>echo Merry Christmas | imconvert -font Arial -pointsize 72 -fill red -background green "label:@-" -trim cap_l.png
imconvert: unable to read blob `-': No such file or directory @ blob.c/FileToBlob/868.
imconvert: missing an image filename `cap_l.png' @ convert.c/ConvertImageCommand/2710.
>echo Merry Christmas | imconvert -font Arial -pointsize 72 -fill red -background green -size 1000x500 caption:@- -trim c
ap_c.png
imconvert: geometry does not contain image `@-' @ statistic.c/GetImageBoundingBox/217.
imconvert: unable to read blob `-': No such file or directory @ blob.c/FileToBlob/868.
This is with ImageMagick 6.4.6 2008-12-01 Q8
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
the first thing is says is that caption: requires a -size setting
Yes I know, that's why I said "I can make the -size much larger than it needs and it still complains "[/code]
Works for me under linux. Could pipelines be a problem under windows?
I have had no indication that '@' needs any form of escaping under windows. But no reports of success for it either. Of course I am not a windows user so can only go by what I have been told.
And what I have been told has been noted in IM examples, http://www.imagemagick.org/Usage/api/#windows