General ⇒ Extracting Latex source from .png
Extracting Latex source from .png
suppose i have a website like this > http://www.relativitycalculator.com/Alb ... t_II.shtml
does anybody know you can extract the latex coding from the equations which are all in .png format??
thanks, this would be an enormous help
does anybody know you can extract the latex coding from the equations which are all in .png format??
thanks, this would be an enormous help
NEW: TikZ book now 40% off at Amazon.com for a short time.

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Re: Extracting Latex source from .png
There is no LaTeX coding in PNG files, hence there is nothing to extract. You have to rewrite the equations by yourself. Not really a big challenge.
Best regards
Thorsten¹
Best regards
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Extracting Latex source from .png
thankyou for your reply, although i am a total newbie to latex i know its not difficult however it would save me a great deal of time if i could get to the coding so basically i am looking for a shortcut
i found this on the net form here http://www-cdf.fnal.gov/~cplager/latex/#png
cannot be used??
or even this
http://www.fauskes.net/nb/htmleqII/
i found this on the net form here http://www-cdf.fnal.gov/~cplager/latex/#png
Code: Select all
Extracting Latex source from .png File
To get the source code out of a png file that has been made with tex2png.pl, you use the script itself:
cplager@Fcdflnx4> tex2png.pl -extract example.png
Extracting tex source from example.png to example.tex
or
cplager@Fcdflnx4> tex2png.pl -extract example.png savetexhere.tex
Extracting tex source from example.png to savetexhere.tex
or even this
http://www.fauskes.net/nb/htmleqII/
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Extracting Latex source from .png
Until now, I didn't know this Perl script. So, just test it on the PNG files from that website. You only need a Perl interpreter (for instance from ActiveState) and Netpbm. Any report about success is appreciated.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Extracting Latex source from .png
yes, thanks, as i said before i am a newbie and im really looking to save time so cant spend too much time trying to figure to figure things out as im already struggling 

- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Extracting Latex source from .png
Hi kkzs!
I believe if you want to write LaTeX code, you will have to learn it. Of course it could save some time if you could convert those png images, but it does'nt require much knowledge to set common formulas.
Usually png files store all information with bitmap data, just pixels, plus some metadata. From the pixels you cannot reproduce the corresponding LaTeX code, at least I don't know a program that's able to do expression recognition this way.
The mentioned tex2png.pl puts latex code into the image as metadata. Very good, because you are able to extract the original LaTeX code later. But I'm afraid that will not help you, if the png files you need are not created this way.
I just ran pngmeta with one file, that was created by tex2png.pl, and one from that website. The first had LaTeX metadata inside, the other had not.
Stefan
I believe if you want to write LaTeX code, you will have to learn it. Of course it could save some time if you could convert those png images, but it does'nt require much knowledge to set common formulas.
Usually png files store all information with bitmap data, just pixels, plus some metadata. From the pixels you cannot reproduce the corresponding LaTeX code, at least I don't know a program that's able to do expression recognition this way.
The mentioned tex2png.pl puts latex code into the image as metadata. Very good, because you are able to extract the original LaTeX code later. But I'm afraid that will not help you, if the png files you need are not created this way.
I just ran pngmeta with one file, that was created by tex2png.pl, and one from that website. The first had LaTeX metadata inside, the other had not.
Stefan
Extracting Latex source from .png
I believe if you want to write LaTeX code, you will have to learn it.
lol, thankyou for your help, i feared as much
however i am wondering if i can copy and paste from wikipedia? is this possible?
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Extracting Latex source from .png
Hi,
mathmatical wikipedia articles use TeX Syntax. You can click on edit and see the embedded formulas between <math> ... </math> tags. This way you can get their TeX source code.
Stefan
mathmatical wikipedia articles use TeX Syntax. You can click on edit and see the embedded formulas between <math> ... </math> tags. This way you can get their TeX source code.
Stefan
Re: Extracting Latex source from .png
yes i know, but its not a good strategy as im finding it does not always work or the coding is incomplete, its fine for say a normal equation but if you want matrices then i encounter problems
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Extracting Latex source from .png
It should work with matrices too. Of course they are just code snippets, not working standalone. Important is that you include the amsmath package in your LaTeX document, escpecially for matrices and more complex expressions.
Stefan
Stefan