Sunday, 21 August 2011

Check the endianness of your Linux machine

There is a very simple way to check the endianness of your Linux machine. Just type:

printf '\1' | od -dAn

If the answer is 1, then your machine is little endian. If 256, it is big endian.

Thursday, 11 August 2011

Loosless ps-to-pdf conversion in Linux

The easiest way to do convert your eps/ps figures to pdf in Linux (without a quality loss) is to use epstopdf script. It calls ghostview with several compression options as default and it's not possible to change that just from the command line. The quick solution is to change epstopdf itself. It is usually located in /usr/bin/ directory. Line

$GSOPTS = "-dUseFlateCompression=false " unless $::opt_compress;

should be changed to

$GSOPTS = "-dUseFlateCompression=false -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode " unless $::opt_compress;

After the change is made, you can convert your eps to pdf with

epstopdf --nocompress file.eps