Archive

Posts Tagged ‘convert’

convert .txt to .pdf

December 15, 2014 Leave a comment
pandoc input.txt -o output.pdf

By the way, pandoc can convert from / to lots of file formats.

Categories: bash Tags: , ,

animated GIFs

September 3, 2013 Leave a comment

Extract images from a GIF:

convert animated.gif frames%03d.png 

More info here.

Merge images into an animated GIF:

convert -delay 20 -loop 0 *.png result.gif

More info here.

Categories: bash Tags: , ,

Online Convert(er)

January 27, 2013 Leave a comment

http://www.online-convert.com/

I wanted to convert a PDF with Calibre but it failed. I tried with Online Convert(er) too and it succeeded…

Categories: Uncategorized Tags: , , , ,

Resize .tif file and convert to .jpg

November 7, 2011 Leave a comment

Use case
In the lab we have a photocopier that can scan too. Quite cool, you can precise your email address and it sends you the scanned page in .tif format.

However, pages must be scanned one by one and each of them is sent as a separate .tif file. Each .tif file is around 2.8 MB large with a resolution of 4900 x 7000 pixels. How to resize them and convert them to .jpg files? Gimp is one way but could we solve it in command-line?

Solution
Put the .tif files in a folder and create a subfolder called “out”. This way the output won’t be mixed with the input.

for i in *.tif; do echo $i; convert $i -resize 24% out/`basename $i .tif`.jpg; done

Each .tif is made smaller (width around 1200 pixels) and converted to .jpg.

As a final touch, convert the JPGs to a PDF file.

cd out
convert *.jpg doc.pdf

Question
Does anyone know how to to resize an image the following way: let width be 1200 pixels and keep the aspect ratio? Above the 24% was the result of a manual computation…

Answer: just use “convert -resize 1200 in.tif out.jpg“. The output will have width=1200 pixels with the same ratio as the input image. (Thanks Yves for the tip.)

Convert HTML to PDF

February 17, 2011 4 comments

In this thread you will find a list of “HTML to PDF” converters, e.g.:

WKhtmlToPDF

Simple shell utility to convert html to pdf using the webkit rendering engine, and qt.

You can get its binary executable here. Then, you can convert an html to pdf like this:

wkhtmltopdf-i386  test.html  test.pdf

The result will be similar to exporting the page in PDF in a browser. This is not a surprise, wkhtmltopdf contains the WebKit rendering engine.

View .djvu files

December 25, 2010 Leave a comment

Problem

You want to open .djvu files. Maybe you’d like to convert them in PDF format too.

“DjVu (pronounced like déjà vu) is a computer file format designed primarily to store scanned documents, especially those containing a combination of text, line drawings, and photographs. It uses technologies such as image layer separation of text and background/images, progressive loading, arithmetic coding, and lossy compression for bitonal (monochrome) images. This allows for high-quality, readable images to be stored in a minimum of space, so that they can be made available on the web.” (source)

Solution

The default document viewer of Gnome (evince) can open these files, but it’s quite slow. There is a better program for this format called djview4.

sudo apt-get install djview4

This program can also export .djvu files in PDF format (however, it’ll take some while, the conversion is quite slow).

To open .djvu files with Midnight Commander, add these lines to ~/.mc/bindings:

regex/\.djvu$
   Open=djview4 %f &
Categories: ubuntu Tags: , , , ,

PNG to EPS

December 22, 2010 5 comments

Problem

You use “latex” and you want to convert a PNG file to EPS format. Using Gimp, for instance, produces an ugly output.

Solution

Try the png2eps script of Henlich. Works fine :)

Under Ubuntu 10.10, I had to install the following package:

sudo apt-get install pngcheck

Plus, I had to remove the -indexbits=… option from the script.

Credits

Thanks Mehdi for the tip.

Categories: bash Tags: , , ,
Follow

Get every new post delivered to your Inbox.

Join 73 other followers