473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

PNG to EPS with Python?

I have .PNG image I would like to convert to .EPS (Enhanced
PostScript), for inclusing in LaTeX documents. I feel that a portable
tool for this would be very welcome in the scientific community, where
they still LaTeX a lot! There is a png2eps tool for linux/unix, but I
can't find something that works on Windows. Perhaps somebody with
Cygwin can produce an .exe (I don't use Cygwin anymore myself)? I
wonder if this would be possible to do with Python, or maybe somebody
already did this? Instead of PNG also JPG, GIF, TIFF, etc. would be
welcome, as it is easy to convert PNG back and forth to those, even on
Windows :-)
Jul 18 '05 #1
2 8928
In article <cb**************************@posting.google.com >,
hw***@hotmail.com (Will Stuyvesant) wrote:
I have .PNG image I would like to convert to .EPS (Enhanced
PostScript),
"Encapsulated PostScript", actually.
for inclusing in LaTeX documents. I feel that a portable
tool for this would be very welcome in the scientific community, where
they still LaTeX a lot! There is a png2eps tool for linux/unix, but I
can't find something that works on Windows. Perhaps somebody with
Cygwin can produce an .exe (I don't use Cygwin anymore myself)? I
wonder if this would be possible to do with Python, or maybe somebody
already did this? Instead of PNG also JPG, GIF, TIFF, etc. would be
welcome, as it is easy to convert PNG back and forth to those, even on
Windows :-)


Have you looked at PIL yet?

Just
Jul 18 '05 #2
> [Just]
Have you looked at PIL yet?


No, I had not, and thank you for the suggestion Just!

WOW, PIL is amazing! I was looking all over the internet for
"png2eps" etcetera, but my favorite programming language can do it
all with PIL!
A simple recipe to put a screenshot in your LaTeX file under Windows
(where there is no png2eps utility):

First of all you have to install PIL, get the Windows .exe and run it,
nice and simple.
Then copy the screenshot to your Windows clipboard with
<SHIFT><ALT><PrtSc> or whatever keycombo your keyboard has. Then
open MSPAINT.EXE, "paste" the image in there (via the Edit menu) and
"save as" a .PNG file via the File menu (for name I filled in
"myscreenshot"). Then open CMD.EXE and go to the directory where
you did save the .PNG and start the Python interpreter there. Now
just
import Image
im = Image.open("myscreenshot.PNG")
im.save("myscreenshot.eps")


This produces a hefty 9MB .eps file for my test screenshot, but when
you include it in your LaTeX with
\includegraphics[width=\textwidth]{myscreenshot.eps} and produce PDF
from the LaTeX (witht the MikTeX dvipdfm.exe) it amounts to only
about 90k for a PDF file with one page with the screenshot on it.
If you produce .PS from the LaTeX then it is still 9MB :-)
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.