Is there any possibility to convert an image file into TikZ/qTikZ code? May be I can give the image I want.


Not only this picture, I have to convert lot. Because if we are working with JPG files it is giving so large file when we are going for a book and all.

And if we are working with TikZ fils its easy to work with and its giving less memory file only.

  • 1
    I haven't tried this myself, but I know you can convert jpg to svg, then there is this post: tex.stackexchange.com/questions/60422/how-to-export-svg-to-tikz discussed converting svg to tikz. The result may not be too good though.
    – Francis
    Commented Oct 12, 2015 at 6:41
  • 4
    TikZ is not the thing for that kind of image I'd say, but if you can settle for somewhat simpler shapes then it's fine. However, that would mean a lot of work in essentially redrawing the figures. I would think that tracing that image in Inkscape (cf. the question linked by Francis) and exporting to TikZ code would create fairly long code as well, but you can always give it a go. Commented Oct 12, 2015 at 6:49
  • 2
    you are unlikely to get better compression with tikz than jpeg you could of course make the filesize arbitrarily small by reducing the image resolution in an image editing tool (for example the file as posted above is not so big) Commented Oct 12, 2015 at 6:50
  • 1
    Perhaps what you are asking is how to include a JPG as part of a tikz picture? In such a case you can do it with \node {\includegraphics{image.jpg}; but of course this does not "convert" the image in tikz code, only allows you to mix it with more tikz code.
    – JLDiaz
    Commented Oct 13, 2015 at 8:12

1 Answer 1


Short answer: No. Just keep using \includegraphics with your jpeg files.

Longer answer:

  • use something like inkscape or potrace (a command-line tool that has been assimilated into inkscape) to convert to some form of vector graphic (e.g. svg)
  • use something like SVG2TikZ to convert to tikz code
  • write and debug a script to batch-convert each image in your image folder into tikz code
  • start inserting large chunks of tikz into your document
  • realise that you have larger pdf files and worse-looking graphics
  • go back to using includegraphics with your jpeg files.

(Posted as community wiki, since it is a summary/extension of the partial answers posted as comments above... also, since it is not terribly helpful.)

  • may give me an example of doing it..because i tried in this way.. but i could nt get it..better if u are providing screen shots ..@andrew
    – David
    Commented Oct 13, 2015 at 8:46
  • so \includegraphics wasn't working? Commented Oct 13, 2015 at 8:52
  • Thats working...but I need it in codes
    – David
    Commented Oct 13, 2015 at 8:57
  • 1
    Sorry, I don't understand what you mean by "codes". The answer was to stick with \includegraphics. Built into the answer was the advice that you could waste a lot of time trying to turn non-vector graphics (gradients etc) into vector graphics (paths and fills) and end up with something worse than just embedding a jpeg of an appropriate resolution. Here is a commercial web site that makes a business out of doing things that are probably not as good as what you have in mind: vector-conversions.com/graphics/vector/… Commented Oct 13, 2015 at 9:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .