The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
lorytibi
Posts: 4 Joined: 2015-02-12T09:55:20-07:00
Authentication code: 6789
Post
by lorytibi » 2015-02-12T10:00:06-07:00
Hi,
I want to convert .SVG image to .TIF.
With the following code the result TIF file looks like a MVG file
Could somebody tell me what did I wrong?
Code: Select all
MagickBooleanType status;
MagickWand* magick_wand;
MagickWandGenesis ();
magick_wand = NewMagickWand ();
status = MagickReadImage (magick_wand, fullSvgPath);
if (status != MagickFalse) {
MagickResizeImage (magick_wand, width * 2, height * 2, UndefinedFilter, 1.0);
MagickSetImageFormat (magick_wand, "TIFF");
MagickSetImageCompression (magick_wand, Group4Compression);
MagickSetImageCompressionQuality (magick_wand, 0);
MagickStripImage (magick_wand);
status = MagickWriteImage (magick_wand, fullTifPath); // fullTifPath ends with ".tif"
if (status == MagickFalse) {
ThrowMagickWandException (magick_wand);
}
} else {
ThrowMagickWandException (magick_wand);
}
magick_wand = DestroyMagickWand (magick_wand);
MagickWandTerminus ();
Thanks in advance!
Regards,
Tibor
Last edited by
lorytibi on 2015-02-12T10:05:34-07:00, edited 2 times in total.
dlemstra
Posts: 1570 Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:
Post
by dlemstra » 2015-02-12T10:02:38-07:00
Are you using the latest version of ImageMagick?
lorytibi
Posts: 4 Joined: 2015-02-12T09:55:20-07:00
Authentication code: 6789
Post
by lorytibi » 2015-02-12T10:04:33-07:00
dlemstra wrote: Are you using the latest version of ImageMagick?
I'm using ImageMagick-6.9.0
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2015-02-12T13:12:39-07:00
The latest version is 6.9.0.5. You need to find the exact minor version.
convert -version
should tell you exactly what version you are using.
lorytibi
Posts: 4 Joined: 2015-02-12T09:55:20-07:00
Authentication code: 6789
Post
by lorytibi » 2015-02-16T05:35:20-07:00
Code: Select all
Version: ImageMagick 6.9.0-0 Q16 x86_64
If I try to make .BMP file from the .SVG, then it's created successfully.
It only works wrong with .TIF file format
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2015-02-16T11:54:09-07:00
What delegated do you have installed? Does it contain libtif? To see what is installed,
convert -version
and it will tell you about your delegates. If it is there, perhaps it is too old and needs to be upgraded.
lorytibi
Posts: 4 Joined: 2015-02-12T09:55:20-07:00
Authentication code: 6789
Post
by lorytibi » 2015-02-17T02:01:12-07:00
Code: Select all
$ convert -version
Version: ImageMagick 6.9.0-0 Q16 x86_64 2015-02-16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules
Delegates (built-in): bzlib djvu fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms ltdl lzma openexr png ps tiff webp x xml zlib
I can't find "libtif" in the delegates, but "tiff" is there.
UPDATE:
I can successfully convert my .SVG image to .TIF in command line with "convert _.svg _.tif" command.
It only can't work with MagickWand
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2015-02-17T10:49:49-07:00
I can't find "libtif" in the delegates, but "tiff" is there.
That is correct. So you do have libtif otherwise, tiff would not show there.
Sorry I cannot help with the API issue.
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2015-02-17T11:43:17-07:00
In cases like this, it is best to provide a complete but minimal program with a source image that shows the problem.
With IM 6.9.0-0 I built a program that contains your code, and it works for an SVG file, making a proper TIFF file.