Scheme is yucky.
And the need to rescale after setting resolution
but maintaining the height and width isn't documented
anywhere.
And the arguments to the PNG save function are a real
killer, since most examples show them to be zeros, and
the docs assume some serious graphics knowledge.
\n; Setup input file name\n(set! infile (car '("c:\\work\\from.png")))\n\n; Load the file\n(set! image ( car (file-png-load 0 infile infile )))\n\n; Show it - for debugging only\n(set! window (car (gimp-display-new image)))\n\n; Pull out the drawable layer\n(set! drawable (car (gimp-image-active-drawable image)))\n\n; Get rid of the non black text\n(gimp-threshold drawable 100 255)\n\n; Crop to the paragraph sides\n(plug-in-autocrop 0 image drawable)\n\n; Change the print resolution \n(gimp-image-set-resolution image 300 300)\n\n; Get the height and width to plug back in to the rescale\n(set! height (car(gimp-image-height image)))\n(set! width (car(gimp-image-width image)))\n\n; Apply the 300 x 300 - don't change the height or width\n(gimp-drawable-transform-scale drawable 0 0 width height 0 1 0 3 0)\n\n; Setup the output file name\n(set! outfile (car '("c:\\work\\test_out.png")))\n\n; Save it, along with the various flags pieces, with full compression\n(file-png-save 1 image drawable outfile outfile 0 9 1 1 1 1 1)\n