[l2h] netpbm 9.8 & cropping bars

Norbert Irmer Norbert Irmer <norbert.irmer@heim9.tu-clausthal.de>
Fri, 10 Nov 2000 07:21:54 +0100


Bruce R Miller wrote:
> 
> Hello yet again;
>   I noticed that netpbm is now being supported again from sourceforge,
> and that it includes the png stuff.  So I fetched & installed it.
> 
> Unfortunately, I'm now getting those infamous cropping bars.
> Has anybody figured out what adjustments to make?   Or any pointers as
> how to best determine what to adjust?
> 
> Thanks
> --
> bruce.miller@nist.gov
> http://math.nist.gov/~BMiller/

Hi,

I had the same "cropping bar" problem.

After some investigation I found out that the problem is,
that 

 "pnmcrop -bot"

doesn't works with the new pnmcrop version.

I think this is because two edges of the image which has to be cropped 
are black and two are white, so pnmcrop thinks that black is
the foreground color and doesn't crops the black bars.

I hacked my pstoimg script so that it works with the new pnmcrop tool,
but I don't know how compatible my changes are.
But perhaps this gives Ross the right idea where the problem lies :)

Here is my hacked, new version:

  # RRM: Remove justification bars
  $EXTRA_CROP =~ s/h/bt/gi; # crop horizontally
  $EXTRA_CROP =~ s/v/rl/gi; # crop vertically
  while ($EXTRA_CROP =~ /([atblrs])/gi) {
    my $edge = $1;
    my $croparg = '';
    if($edge =~ /b/i) {
      $croparg = '-black -bot ';
    } elsif($edge =~ /[tlr]/i) {
      $croparg = "-black -$edge ";
    } elsif($edge =~ /s/i) {
      #RRM: shave at most 1-2 rows of white from the bottom
      if($cmd) {
        # Terminate command pipe
        &do_cmd($in,$tmp,$cmd) || return 0; # failure
        $cmd = '';
      }
 

Best regards,
Norbert