/[MITgcm]/manual/pstoimg
ViewVC logotype

Diff of /manual/pstoimg

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1 by cnh, Fri Jul 15 13:07:23 2005 UTC revision 1.4 by cnh, Fri Jul 15 13:37:56 2005 UTC
# Line 15  Line 15 
15  ##############################################################################  ##############################################################################
16  #  #
17  # $Log$  # $Log$
18    # Revision 1.4  2005/07/15 13:37:56  cnh
19    # Seems to work on faulks as well now - yeah (I hope).
20    # Only took staying up all night and some 5000+ attempts.
21    # Not sure why nobody fixed this before :-)!
22    # For my next trick ---- protex!!!
23    #
24    # Revision 1.3  2005/07/15 13:29:25  cnh
25    # Tidying paths to make it work elsewhere - maybe?
26    #
27    # Revision 1.2  2005/07/15 13:20:56  cnh
28    # Slight change to the fix - plus relative path in .latex2html-init
29    #
30  # Revision 1.1  2005/07/15 13:07:23  cnh  # Revision 1.1  2005/07/15 13:07:23  cnh
31  # More cunning tricks to get rid of black lines  # More cunning tricks to get rid of black lines
32  #  pnmcrop is junk!  #  pnmcrop is junk!
# Line 268  my $GSALIASDEVICE = 'ppmraw'; Line 280  my $GSALIASDEVICE = 'ppmraw';
280  # Supported format(s)  # Supported format(s)
281  my @IMAGE_TYPES = qw(png gif);  my @IMAGE_TYPES = qw(png gif);
282  # Netpbm  # Netpbm
283  my $PNMCROP = '/home/cnh/downloads/netpbm-10.19bin/bin/pnmcrop -verbose';  my $PNMCROP = '/usr/bin/pnmcrop -verbose ';
 # my $PNMCROP = '/bin/cat';  
284  my $PNMCROPOPT = '';  my $PNMCROPOPT = '';
285  # $PNMCROPOPT = '-sides';  $PNMCROPOPT = '-sides';
286  # $PNMCROPOPT = '-white';  my $PPMQUANT = '/usr/bin/ppmquant';
287  $PNMCROPOPT = '-black';  my $PNMFLIP = '/usr/bin/pnmflip';
288  my $PPMQUANT = '/home/cnh/downloads/netpbm-10.19bin/bin/ppmquant';  my $PNMCAT = '/usr/bin/pnmcat';
289  my $PNMFLIP = '/home/cnh/downloads/netpbm-10.19bin/bin/pnmflip';  my $PNMFILE = '/usr/bin/pnmfile';
290  my $PNMCAT = '/home/cnh/downloads/netpbm-10.19bin/bin/pnmcat';  my $PBMMAKE = '/usr/bin/pbmmake';
 my $PNMFILE = '/home/cnh/downloads/netpbm-10.19bin/bin/pnmfile';  
 my $PBMMAKE = '/home/cnh/downloads/netpbm-10.19bin/bin/pbmmake';  
291  # GIF support  # GIF support
292  my $PPMTOGIF = '/home/cnh/downloads/netpbm-10.19bin/bin/ppmtogif';  my $PPMTOGIF = '/usr/bin/ppmtogif';
293  # PNG support  # PNG support
294  my $PNMTOPNG = '/home/cnh/downloads/netpbm-10.19bin/bin/pnmtopng';  my $PNMTOPNG = '/usr/bin/pnmtopng';
295  # Temporary diskspace  # Temporary diskspace
296  my $def_tmp = '/tmp'; # Space for temporary files  my $def_tmp = '/tmp'; # Space for temporary files
297    
# Line 295  my $PAGE_HMARGIN = 72;       # dvips mar Line 304  my $PAGE_HMARGIN = 72;       # dvips mar
304  my $PAGE_VMARGIN = 72;       # dvips margin: 1 inch = 72pt  my $PAGE_VMARGIN = 72;       # dvips margin: 1 inch = 72pt
305    
306  # The color to be made transparent  # The color to be made transparent
307  # my $trans_color = '#ffffff';  my $trans_color = '#ffffff';
 my $trans_color = '#000000';  
308    
309  ###############################################################################  ###############################################################################
310  # Default settings  # Default settings
# Line 1110  sub crop_scale_etc { Line 1118  sub crop_scale_etc {
1118    $EXTRA_CROP =~ s/v/rl/gi; # crop vertically    $EXTRA_CROP =~ s/v/rl/gi; # crop vertically
1119    while ($EXTRA_CROP =~ /([atblrs])/gi) {    while ($EXTRA_CROP =~ /([atblrs])/gi) {
1120      my $edge = $1;      my $edge = $1;
1121      my $croparg = ' ';      my $croparg = '';
1122      if($edge =~ /b/i) {      if($edge =~ /b/i) {
1123        $croparg = "-bot $PNMCROPOPT ";        $croparg = "-bot $PNMCROPOPT ";
1124      } elsif($edge =~ /[tlr]/i) {      } elsif($edge =~ /[tlr]/i) {
# Line 1119  sub crop_scale_etc { Line 1127  sub crop_scale_etc {
1127        #RRM: shave at most 1-2 rows of white from the bottom        #RRM: shave at most 1-2 rows of white from the bottom
1128        if($cmd) {        if($cmd) {
1129          # Terminate command pipe          # Terminate command pipe
1130          $cmd .= "| pnmcrop -white -bot -verbose | pamcut -bottom 200 -pad | pnmcrop -black -bot -verbose";          ### CNH trick to get rid of black lines at bottom of some equations
1131            $cmd .= "| pnmcrop -white -bot -verbose | pnmcrop -black -bot -verbose | pnmcrop -white -bot -verbose | pnmcrop -black -bot -verbose";
1132          &do_cmd($in,$tmp,$cmd) || return 0; # failure          &do_cmd($in,$tmp,$cmd) || return 0; # failure
1133          $cmd = '';          $cmd = '';
1134        }        }
1135        my ($type,$width,$height) = get_image_geometry($in);        my ($type,$width,$height) = get_image_geometry($in);
       #CNH add begin  
       ###CNH next  
       #CNH add end  
1136        next unless($type); # skip if no geometry        next unless($type); # skip if no geometry
1137        if(&do_cmd_norename("$PNMCROP $PNMCROPOPT -bot < $in",$tmp)) {        if(&do_cmd_norename("$PNMCROP $PNMCROPOPT -bot < $in",$tmp)) {
1138          my ($type,$width,$height2) = get_image_geometry($tmp);          my ($type,$width,$height2) = get_image_geometry($tmp);
1139          if($type && ($height - $height2) < 30 ) {          if($type && ($height - $height2) < 3 ) {
1140            # command succeeded and shaved less than 3 rows            # command succeeded and shaved less than 3 rows
1141            if($opt{debug}&&(-f $tmp)) {            if($opt{debug}&&(-f $tmp)) {
1142              L2hos->Copy($tmp,$in);              L2hos->Copy($tmp,$in);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.22