[Gllug] Image cropping from a script

- Tethys tethys at gmail.com
Fri Jul 6 10:45:29 UTC 2007


On 7/4/07, Nix <nix at esperi.org.uk> wrote:

> 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.

Yep, that would probably work. But in the end, I just used ppmmake to
create a one colour palette file as you suggested, and then pnmremap
with -mapfile and the -missingcolor option to turn everything but the
pixels of the colour in which I'm interested into the same background
color, and then pnmcrop works fine. It was simpler than trying to
craft a suitable file for pamlookup. If I'd needed to preserve the
other colours in my cropped area, then my method wouldn't have worked,
but for this particular application, I don't.

Tet

-- 
Perl is like vise grips. You can do anything with it but it is the
wrong tool for every job. -- Bruce Eckel
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list