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

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.
Post Reply
lorytibi
Posts: 4
Joined: 2015-02-12T09:55:20-07:00
Authentication code: 6789

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

Post 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
Last edited by lorytibi on 2015-02-12T10:05:34-07:00, edited 2 times in total.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Convert .SVG to .TIF

Post by dlemstra »

Are you using the latest version of ImageMagick?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
lorytibi
Posts: 4
Joined: 2015-02-12T09:55:20-07:00
Authentication code: 6789

Re: Convert .SVG to .TIF

Post by lorytibi »

dlemstra wrote:Are you using the latest version of ImageMagick?
I'm using ImageMagick-6.9.0
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
lorytibi
Posts: 4
Joined: 2015-02-12T09:55:20-07:00
Authentication code: 6789

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

Post 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 :(
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
lorytibi
Posts: 4
Joined: 2015-02-12T09:55:20-07:00
Authentication code: 6789

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

Post 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 :(
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
Post Reply