For exporting eps figures from Matlab i use matlabfrag and laprint functions so that i split the psfrag commands (.tex) and figure(.eps) streams. During the compilation using pstool or auto-pst-pdf packages, figures with latex text font are automatically added.

But my question is :

How to add figure labels,legends for .png figures similar to psfrag? As the .png is from third-party software.

Can i convert .png to tagged .eps and then add text using psfrag commands?

I prefer to save figures in tagged eps (.eps and .tex) instead of .pdf so that i can add latex font based on the beamer or article class used. I don't like to freeze the font of text in figures by using PDF.

  • 1
    I think Inkscape allows to import bitmap graphics and export them as eps+latex. But I have never used it so far. – matth Jun 19 '12 at 16:32
  • 3
    Inkscape can do latex+pdf. just import a bitmap, trace it or leave it as is, add text and then export as pdf. A window will pop-up and lets you chose +latex. Also consider packages like overpic or of course tikz that let you overlay a picture with text. – Martin H Jun 19 '12 at 16:45
  • related: tex.stackexchange.com/questions/9559/… – matth Jun 28 '12 at 9:48

You can't get TeX to find text in a png the way it does for psfrag as essentially the information just isn't there (even if TeX could read the binary file). However if the png image has no text at all you can overlay latex text over it. there are packages to help that but you don't really need a package.

\put(-100,2){label 1}
\put(-100,-22){label 2}

overlays the two labels over the image. Of course you have to judge the coordinates by eye or some external measurement.

| improve this answer | |
  • Does Inkscape generate the picture environment as shown in your example when i add text on the png in Inkscape as suggested by Others. – texenthusiast Jun 19 '12 at 21:37
  • 1
    No idea, i have never used inkscape:-) – David Carlisle Jun 19 '12 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.