[l2h] netpbm 9.8 & cropping bars
Ross Moore
Ross Moore <ross@ics.mq.edu.au>
Fri, 10 Nov 2000 17:55:27 +1100 (EST)
> Bruce R Miller wrote:
> >
> > 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?
> 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.
The old version would crop a whole edge, provided it was all the same
color. It didn't need to be black or white.
When cropping all around, I think it was the right-hand edge which
was examined to determine the color to be cropped.
> 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 = '';
> }
>
With the TeX code currently placed into the header of images.tex there
is no reason to assume that the cropping-bars will be black.
They are the same as the \current@color used for ordinary text.
Your suggested edit will thus require changes in images.tex so as to work
with colored contents; e.g. I can program it so that the cropping bars are
always black, no matter what color are the contents and background-color.
(Then there is the added complication in case the \pagecolor is black,
e.g. with white text --- sounds like a new Perl variable is needed to cope
with this case.)
> Best regards,
> Norbert
Thanks for the report Norbert.
By the way, have you been able to get pnmcrop to give a usage message ?
It seems that pnmcrop --help is no longer supported.
Is there an alternative ?
All the best,
Ross Moore