Differencebetween Imagemagick and Graphicsmagick

What is the difference between ImageMagick and GraphicsMagick?

From what I have read GraphicsMagick is more stable and is faster.
I did a couple of unscientific tests and found gm to be twice as fast as im (doing a resize).

Any way to differentiate between ImageMagick and GraphicsMagick COM objects?

I asked this question on the GraphicsMagick mailing list: Why is the GraphicsMagick COM object called ImageMagick? Here is part of Bob Friesenhahn's response:

I agree it is confusing.
GraphicsMagick does offer a COM
object. The history is interesting.
The original ImageMagickObject was
developed under the GraphicsMagick
project by the same author as the
original ImageMagickObject. The
current ImageMagickObject was
developed under the GraphicsMagick
project and Bill Radcliffe retained
the original name.

I am not aware of a way to specify
using a particular ImageMagickObject
COM implementation if both are
registered. Is it even possible to
register two COM objects under the
same name at once?

As far as being able to tell which one
is in use at run time, it seems that
passing the argument '-version' might
be used to return some useful info.

If I understand COM correctly, I believe this basically means that whichever library was registered most recently--ImageMagick or GraphicsMagick--will be the one called from within the code.

What is the difference between ImageMagick and libGD?

according to this source, you should use GD:

GD and other modules built on top of that (like GD::Graph) are more aimed at producing "new" images like charts.

And you can read "Develop your own weather maps and alerts with Perl and GD", which is what you're looking for.

If you some some time. try them both, play a little, and decide.

Ignore ImageMagick or GraphicsMagick warning

If I'm reading Exception.cpp correctly, Magick::Exception is too generic. Try isolating the warnings from the errors.

try {
Magick::Blob buff = Magick::Blob(input, inLen);
pImage->read(buff);
} catch (Magick::Warning &warning) {
// Ignore, or log
} catch (Magick::Error &error) {
cout << error.what() << endl;
delete(pImage);
return -1;
}

mogrify with caption (imagemagick or graphicsmagick)

magick is for IM 7 and convert is for IM 6. If you need to do mogrify, then you must prepare the text image in a separate command and save it. Then use -draw in mogrify to do the composite. But if you are processing only one image at a time, then convert is the more flexible option and will allow compound statements and composite. Mogrify does not allow both input and output images. It takes an asterix wild card (or one file) and processes it writing the output over the input, unless you provide an output directory. See the links I mentioned in my last comment.

Here are 3 ways to do it. The first two use magick on IM 7 and the third creates a text image using magick and then uses magick mogrify to composite it using -draw. I recommend that you use the second method and if you have many images to process, then write a script loop over each input image.

Input:

Sample Image

This uses composite:

magick lena.jpg -resize 300x -crop 300x200+0+50 +repage -extent 300x290 \( -size 300x90 -gravity SouthWest -font "Arial" -pointsize 24 -fill black caption:'This is some really long stuff that goes on 3 lines so how will it ever fit' \) -compose over -composite -quality 100 lena_result1.jpg


Sample Image

This is simpler with no extent, just append:

magick lena.jpg -resize 300x -crop 300x200+0+50 +repage \( -size 300x90 -gravity SouthWest -font "Arial" -pointsize 24 -fill black caption:'This is some really long stuff that goes on 3 lines so how will it ever fit' \) -append -quality 100 lena_result2.jpg


Sample Image

This creates the text image and saves as tmp.png:

magick -size 300x90 -gravity SouthWest -font "Arial" -pointsize 24 -fill black caption:'This is some really long stuff that goes on 3 lines so how will it ever fit' text.png


Sample Image

Then it uses -draw to composite the test.png image onto the one input to magick mogrify, which is always specified last in the command. The output is written over this input:

magick mogrify -resize 300x -crop 300x200+0+50 +repage -extent 300x290 -draw "gravity southwest image over 0,0 0,0 'text.png'" lena2.jpg


Sample Image

In the above, I have used Unix syntax. For Windows, remove the \ from before ( and before ).



Related Topics



Leave a reply



Submit