24 Oct ’08

Mashing vector graphics with bitmaps


When publishing figures, you want your images to look sharp. When processing figures with lots and lots and lots of data points (i.e. proteome comparisons), you do not want to store all these dots in a svg format. Rather, you want to convert the dots to a png picture, import the png into inkscape, and then add the axis, the labels and shuffle around the panels of your figure in the right order.

To be able to do this while retaining quality, some magick is required.



Basically - first figure out how much cm wide you want your panel to be. second, figure out what sharpness you want (dpi). 300 to 600 is usually enough to publish figures in.

As an example, assume that we want a vector pdf image to be scaled to a 17 cm wide png, at a resolution of 600dpi. Using the magic formula of 17 * 600 / 2.56 == 3984 dots, we now know what command line parameters we need to pass to 'convert', the command line imagemagick utility present on a lot of linux distributions. The command line that realizes your dreams is the following:

convert -density 600x600 -units PixelsPerInch plot_virus.pdf -resize 3984x plot_virus.png

Comments






Back to Wandering Thoughts
Me