#!/bin/sh # \/ IN PO \/ #in Po you first choose save as. Then pgm from the drop box #to the lover left (double click). An then simply press "a" #on the keyboard (just because it is the first letter in #the alphabet) and click OK. Quit PO (press q) and run #popnmb (with no arguments) # /\ IN PO /\ #I remove the black edge to the left of the image and #convert it to a two bit black and whit in a way that only #the absolute most black thing, namely the outline will #remain on the image. pamcut -left 2 a |pgmtopbm -threshold -value 0.005 >ret0.pbm; #Now I want to crop the image so that it just fits the #outlined figure. At the same time I #want to cut out the exact same part of the original full color #photo. #first crop of right and bottom edges pnmcrop -right -bottom ret0.pbm >ret1.pbm; #get the name again that we saved earlier name=`cat name.tmp` #Get some information about the image witch #is now crop on two sides. maal=`pnmfile ret1.pbm` #isolating from that information the width of the image widtha=`echo -n $maal |sed 's/.*, //' |sed 's/ by .*//'` #isolating from that information the height of the image heighta=`echo -n $maal |sed 's/.*by //'` #now cuting out the same reight and bottom edge from #the original photo. pamcut -width $widtha -height $heighta ${name}.pnm >ret0.pnm; #now I crop on the two resisting sides of the outline-image. pnmcrop -left -top ret1.pbm >ret0.pbm; maal=`pnmfile ret0.pbm` #isolating from that information the width of the image widthb=`echo -n $maal |sed 's/.*, //' |sed 's/ by .*//'` #isolating from that information the height of the image heightb=`echo -n $maal |sed 's/.*by //'` #Now I can't do exactly the same way as before, I have to #cut in from the left side and the top of the original #photo. In order to do that I have to subtract the new #size of the outline-image from the old size of the #outline-image to get the size of what have bin cut #of by pnmcrop. leftcut=`expr "$widtha" "-" "$widthb"` topcut=`expr "$heighta" "-" "$heightb"` #after subtracting I am now ready to do the #cutting pamcut -left $leftcut -top $topcut ret0.pnm >${name}m.pnm; #now I open the outline-image in Po to do some thing #that I can only do manually with the bucked-fill tool #first we have to convert it in to pcx for Po #to be able to open it at all. ppmtopcx ret0.pbm >tmp.pcx; po tmp.pcx