Archive for April, 2007

Convert PS and EPS images to JPEG

Monday, April 23rd, 2007

The reason why I post stuff like this here is twofold. Firstly (is that even a word?), I forget. Chances are that in 3 months I will need this shit again, and won’t remember the exact syntax, or the name of the tool I used. So instead of googling for it, I can just search through my blog archives.

Secondly, chances are that there are quite a few intermediate or beginner latex users out there who may or may not find this useful.

Here is the scenario: you created a beautiful Latex document. In fact it is so awesome that someone approaches you and asks you to send them that incredibly cool chart or figure you used in your paper. So you send the person the eps/ps file and they can’t open it.

The proper raction that should be taken in such situation is of course repeatedly whacking said person on the head with a blunt object until they get a clue. Sadly forcible clue insertion is not always an option, so every once in a while you will need to convert your images into some more luser friendly format.

You can convert any ps or eps file into a jpeg using ghostscript:

gs -sDEVICE=jpeg -dJPEGQ=100 -dNOPAUSE -dBATCH -dSAFER -r300 -sOutputFile=myfile.jpg myfile.eps

This method has one flaw. It produces humongous files. Depending on the eps file you may get something like 2000×3000 pixels which is slightly on the insane side. Also the file size of the JPG will be about 10 times that of the eps.

We will now need to trim and resize the file using some Image Magic tools:

mogrify -trim -resize 800x600 myfile.jpg

Obviously you can put your own dimension instead of the 800×600. Mogrify will resize the image, and also cut down the size of the file to a manageable level. Still, in most cases files obtained using this method were bigger than the eps files used to produce them. It’s best to simply use your photo editing tool (gimp?) and re-export the image/chart to a conventional image format. It will probably yield much better results than this conversion.

On the other hand, if a ps/eps is all you have, this might be useful.

Thesis Status Update

Monday, April 23rd, 2007

Just a quick update before I call it a night.

I finalized my thesis paper on Thursday and sent it to the committee. In it’s final version the paper was 105 pages long. That and a little over 6000 lines of code.

I have my presentation slides ready. I will just need to rehearse it at least once tomorrow to make sure I know what the hell am I talking about.

I’m defending on Tueasday. I probably won’t be posting much till then.

Wish me luck!

The Harderst Super Mario Level

Saturday, April 21st, 2007

This guy just cracked me up. The commentary in the background is priceless:

Btw, I think whoever designed world was on crack! WTF. I give this guy mad props for persistence. I would have given up 5 minutes into the game. P

Convert JPG and PNG to EPS on Windows

Friday, April 20th, 2007

There are two kinds of people in this world - those who are always on the lookout for the nifty tools that will convert the xyz image format to Encapsulated Postscript (eps) and those who have no clue what Encapsulated Postscript is.

Why do we like to convert all kinds of shit to eps so much? It’s because of LaTex. And while the pdflatex has support for most non-postscript image types, you sometimes want to compile your documents into postscript format first for best results.

On most unix systems converting between back and forward between common graphical formats and eps is relatively trivial. There are dozens of small command line apps (most likely developed by and/or for frustrated LaTex users) that will for just that for you. Many systems will actually ship with decent assortment of these tools out of the box.

However if you find yourself editing LaTex documents on windows you might be lacking these tools. Or not. I found myself in this situation the other day, and I was able to find windows port of jpeg2eps as well as the port of the awesome sam2p app that works on bitmaps, png’s and bunch of other file formats. The direct link to the binaries is here.

Once you have the right tools, the rest is easy.

Crunch Time

Thursday, April 19th, 2007

I entered the crunch time for my thesis work. If postings are scarce here over the next few days, it’s because I’m loosing sleep, putting final touches on the thing and generally and freaking out.

I’m defending on the 24th. If you are around you are welcome to come and listen to the presentation under one circumstance - that you don’t ask tricky and difficult questions. ) Richardson, 3rd floor, CS area. You’ll be able to find it from there.