[Gllug] Image cropping from a script

Nix nix at esperi.org.uk
Wed Jul 4 19:53:35 UTC 2007


On 4 Jul 2007, tethys at gmail.com said:

> I need to be able to crop an image from within a script, such that the
> resulting image is the smallest possible rectangle containing pixels
> of a given foreground colour. Any ideas?

I haven't tried it, but it seems to me that you could put something
together using ppmmake (to make a trivial one-colour index), pamlookup
(to create an image with all pixels but your target converted to the
same colour), and then using it as a -borderfile to pnmcrop.

(I'd test it only I don't know a suitable colour value in any of my
images and am feeling too stupid to determine one.)

-- 
`... in the sense that dragons logically follow evolution so they would
 be able to wield metal.' --- Kenneth Eng's colourless green ideas sleep
 furiously
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list