svg to png conversion and latex

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?".
Post Reply
chicagocoyote
Posts: 3
Joined: 2013-02-18T12:52:46-07:00
Authentication code: 6789

svg to png conversion and latex

Post by chicagocoyote »

I just converted a .svg image to a .png with
the simple command:

convert file.svg file.png

This new png file displays fine in various image
display applications such as geeqie, eog (eye of gnome),
and ristretto.

However, when I read this .png into a latex document
this image does not display correctly and is mostly black.

Have people run into this before ?

I have never had an issue with a .png and latex before
and so I suspect that this is an issue with imagemagick
conversion.

Thanks.
chicagocoyote
Posts: 3
Joined: 2013-02-18T12:52:46-07:00
Authentication code: 6789

Re: svg to png conversion and latex

Post by chicagocoyote »

Ok, I just tried the -enhance flag, and the result did
create a .png that could be displayed correctly by
latex:

convert -enhance file.svg file.png
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: svg to png conversion and latex

Post by fmw42 »

I do not see any connection between -enhance (a noise reduction filter) to your problem? Furthermore you would use -enhance after reading the input not before it. It is likely something with your SVG file and whether you have RSVG or IM SVG or some other SVG delegate installed. Though I am not an expert on SVG.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: svg to png conversion and latex

Post by glennrp »

You should try to avoid a workflow that converts the SVG into a raster format and then imports it into LaTeX which is a vector format.
Try writing your original images as EPS and then importing that into LaTeX. See http://en.wikibooks.org/wiki/LaTeX/Importing_Graphics
and other sites found by a google search for "svg latex", e.g., ftp://ftp.dante.de/tex-archive/info/svg ... FLaTeX.pdf
chicagocoyote
Posts: 3
Joined: 2013-02-18T12:52:46-07:00
Authentication code: 6789

Re: svg to png conversion and latex

Post by chicagocoyote »

My workflow includes creating images with gnuplot
and I ran into the bug that is documented here:

http://groups.google.com/group/comp.gra ... 79a36a3712

The bug exists with .png images but not .svg images.

Yes, I _should_ avoid this workflow, but right now,
"convert -enhance" to gnuplot created .svg images
is a work-able solution.
Post Reply