This page has been prepared in order to give instruments to convert the default Bongo output file bongo.ps into other image formats, and with the same cropping area: it may be useful when the same image must be shown as a time-series of plots like this (mp4, 490KB) or this (mp4, 450KB) and, generally, to produce equally-shaped plots. And, possibly, these instruments must work from within the Bongo command file, so that there is no need to remember what it has been done earlier.

How the "crop" commands work

What follows works for all the cropxpdf2png commands (with 'x'=a,b,bb,c,d,e,f,g to manage different croppings)
  • convert pdf to cropped png.
  • To convert bongo.ps to name.pdf use ps2pdf bongo.ps path/name.pdf (with extensions)
  • e.g. ps2pdf bongo.ps ~/www/noaa/spettri/modelli/ap/ssnm.pdf

    The 'convert' parameter "-crop" consists of two terms: say 1428x940 and +140+510 (example values: in the form 1428x940+140+510).

  • The first two values are image dimensions (x and y, in pixels);
  • the second two values are the offset (with respect to some unknown -to me- origin, also if I can guess the bottom right corner). They refers to x and y, in pixels, respectively.
    If the offsets became larger (e.g. from 140 to 160) the plot moves leftward and (e.g. from 510 to 550) upward, freeing space on right and botton, respectively. Now the other two values can be lowered so that the plot will be better centered on the image space. For example, starting from 1428x940+140+510 one can change values to 1418x930+150+520 in order to center the plot. Verify the centering with Geeqie or Gimp. If it needs, Gimp can be used to save images with the so-called "ignored offset".

    Available "crop" commands

    Command cropapdf2png cropbpdf2png cropbbpdf2png cropcpdf2png
    Examples pdf      png pdf      png pdf      png pdf      png
    Command cropdpdf2png cropepdf2png cropfpdf2png cropgpdf2png
    Examples pdf      png pdf      png pdf      png pdf      png
    Command crophpdf2png cropipdf2png crop---- crop----
    Examples pdf      png pdf      png pdf      png pdf      png

    All these commands are shell files to be copied to the /usr/local/bin directory. Their mode will be:
    "chmod +x crop*"

    The complete list of the crop-commands is here.

    Other "convert" commands

    ps2png pdf2png pdf2png-all pdf2jpg png2pdf

    All these commands are also shell files to be copied to the /usr/local/bin directory. Their mode will be:
    "chmod +x pdf2*" or "png2*" or "ps2*"

    The command pdf2png-all converts all the .pdf files from the current directory into .png. It is the only command which requires Perl.
  • The author thinks a density of 200x200 dpi is fine for such a kind of plots, but you can change the "-density" parameter to, e.g., 300x300 dpi by editing the command(s).
  • Remember that the above-mentioned command ps2pdf is a system (Linux) command and requires the extension in the file names (.ps and .pdf).

    All the above commands can be embedded within a Bongo command file in the form:
    id fz ! normally, the last line in a Bongo command file (change author's id "fz" to your own id)
    quit ! writes bongo.ps but does not exit Bongo
    dos ps2pdf bongo.ps pdf_file_name.pdf ! converts bongo.ps to name.pdf
    dos cropapdf2png pdf_file_name ! converts (with cropping *a*, here) pdf to png (same file_name)
    echo pdf and png files written to <some directory> ! end of conversions (not necessary, but informative)

    Page written: 30 October 2014.                   Last Updated: