Page 1 of 1

Converting .SVG to .TIF but it creates .MVG instead

Posted: 2015-02-12T10:00:06-07:00
by lorytibi
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

Re: Convert .SVG to .TIF

Posted: 2015-02-12T10:02:38-07:00
by dlemstra
Are you using the latest version of ImageMagick?

Re: Convert .SVG to .TIF

Posted: 2015-02-12T10:04:33-07:00
by lorytibi
dlemstra wrote:Are you using the latest version of ImageMagick?
I'm using ImageMagick-6.9.0

Re: Converting .SVG to .TIF but it creates .MVG instead

Posted: 2015-02-12T13:12:39-07:00
by fmw42
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.

Re: Converting .SVG to .TIF but it creates .MVG instead

Posted: 2015-02-16T05:35:20-07:00
by lorytibi

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 :(

Re: Converting .SVG to .TIF but it creates .MVG instead

Posted: 2015-02-16T11:54:09-07:00
by fmw42
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.

Re: Converting .SVG to .TIF but it creates .MVG instead

Posted: 2015-02-17T02:01:12-07:00
by lorytibi

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 :(

Re: Converting .SVG to .TIF but it creates .MVG instead

Posted: 2015-02-17T10:49:49-07:00
by fmw42
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.

Re: Converting .SVG to .TIF but it creates .MVG instead

Posted: 2015-02-17T11:43:17-07:00
by snibgo
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.