#!/bin/ksh # # Script '$HOME/sgiRGB2hprtl_HPDeskJet' # # similar to Montandon's script '$HOME/sgiscrn2hprtl_HPDeskJet' -- # but removed the screen-capture stuff at the front of that script # -- i.e. assumes the user already has an SGI-RGB file. # # An evolving master-copy of this script is the # script: sgiRGB2hprtl_HPDeskJet in $FEDIR/scripts # where FEDIR=/apps/nns_com/fea # ######################################################################### # # Purpose: To provide high quality HP printer files (i.e. PRINTOUT) from # SGI rgb files to color & black-white DeskJet and LaserJet # printers. # ######################################################################### # Called by: Manually (Could use an alias, like # alias rgb2dkj='$HOME/sgiRGB2hprtl_HPDeskJet' # in user .profile file. # Example call by alias name at command line: # rgb2dkj my.rgb) # or, usually, # Iconize this script with SGI Toolchest 'Find,An Icon' # and drop RGB file icons on the script icon. # # This script uses variable $1 to get RGB filename. ######################################################################### # # Critical component: # Uses Image Alchemy to create # 1) HP-RTL (for color Deskjet/Laserjet printers) # OR # 2) HP-PCL (for gray-scale/black-white Laserjet/Deskjet printers) # for Deskjet/Laserjet printers WITHOUT (or with) PostScript # interpreters. # (There is no 'topcl' or 'tortl' utility delivered with IRIX.) # # Creates relatively SMALL, Alchemy-translated screen-capture files # (of hi-quality) -- i.e. faster printouts and less network traffic # compared to the SGI 'tops' utility, which converts SGI .rgb # files to huge Postscript files. # ######################################################################### # # Processing logic: # Uses the 'alchemy' program -- to translate the .rgb file into a # 1) color HP-RTL print file # or 2) gray HP-PCL print file # or 3) black-white HP-PCL print file. # # -------------------------------------------------------------------------- # # Uses 'xconfirm' to ask # 1) whether a landscape or portrait orientation print is wanted. # 2) whether a color (HP-RTL) or gray-scale (HP-PCL) or # black-white (HP-PCL) print is wanted. # 3) Invert image? -- esp. black background to white. # 4) Blur? -- none, moderate, or heavy. # 5) Uses 'imgworks' (or 'imgview') to view the to-be-translated # .rgb file. # (imgworks or imgview could be used to crop the .rgb file # before feeding it to Alchemy for # the conversion to RTL or PCL.) # x) DotsPerInch wanted -- 300 or 600 (or 200 or 150). # (Instead of prompting, sets DPI based on plot-size requested.) # x) What type of scaling algorithm to use to scale the raster # image to the 8.16"x10.66" or 8.16"x10.16" printable area? # (a,b,c, or d) # (Using 'b' seems best; de-activated this prompt.) # # 6) whether printout is wanted. # 7) DeskJet plotter to use. # # The x) prompts could be activated but are defaulted. # # Could use NNS_HPBW_PRINTER or NNS_HPCOLOR_PRINTER to determine # whether to print and where to print. # # -------------------------------------------------------------------------- # Background-related processing (in step 2): # # To output COLOR images, optionally uses 'repcolor' to # change the black background to white (and, perhaps unfortunately, # other blacks to white). I.e. end result can be a color shaded # design on a white background. # # To output GRAY-SCALE images, optionally uses 'invert' to # change the black background to white (and, perhaps unfortunately, # other blacks to white and inverts grays). I.e. end result can # be gray or color design info on a white background. # # To output BLACK-WHITE images (esp. wireframe/lines/text images), # uses 'imgexp' to convert color/gray to white or black -- after, # optionally, using 'invert' to switch black/white. # End result can be black design/lines on a white background # -OR- white design/lines on a white background. # # -------------------------------------------------------------------------- # # Note1: In Jul98, there was no viewer on SGI for HP-PCL or HP-RTL files. # An appropriate HP-compatible plotter is the viewer for these files. # # Note2: Instead of putting HP PCL/RTL files in a /local/scratch directory, # the FILEOUT variable below can be set to direct the output file # to $HOME/temp.pcl or $HOME/temp.rtl -- for example, to facilitate # FTP of the file to a PC-NT file system via login to the 'sgia' # server rather than the SGI workstation. However, # to keep down traffic on the network for these rather large files # (about 1 to 10 Meg) FILEOUT may be set to a local file like # /local/scratch/${USER}_temp.rtl (or .pcl). # # Written by: Blaise Montandon E40/C61 17Jul98 based on # sgiscrn2hprtl_HPDeskJet & # sgiRGB2hprtl_HPDesignJet # Updated by: Blaise Montandon E40/C61 17Jul98 # # Title for xconfirm windows: WINTITLE="SGIrgb2hpDeskJet" # Postion xconfirm windows -- Right side of the screen: WINGEOM="-geometry +960+450" # 'man X' says # +0+0 upper left hand corner. # -0+0 upper right hand corner. # -0-0 lower right hand corner. # +0-0 lower left hand corner. RGBFILE=$1 if test ! -f $RGBFILE then /usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -B DISMISS \ -t " Current directory: `pwd`" \ -t "" \ -t "The input FILE" \ -t "" \ -t " $RGBFILE" \ -t "" \ -t "DOES NOT EXIST. " \ -t "" \ -icon warning exit fi # For lp/lpr print-command-determination scripts: FEDIR="/apps/nns_com/fea" # For rgb file conversions -- tobw, invert, blur, etc. TEMPRGB="/local/scratch/${USER}_temp.rgb" TEMPRGB2="/local/scratch/${USER}_temp.rgb2" # export TEMPRGB rm -f $TEMPRGB cp $RGBFILE $TEMPRGB if test ! -f $TEMPRGB then /usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -B DISMISS \ -t " Current directory: `pwd`" \ -t "" \ -t "CANNOT COPY YOUR RGB FILE" \ -t "" \ -t " $RGBFILE" \ -t "" \ -t "TO " \ -t "" \ -t " $TEMPRGB" \ -t "" \ -t "CALL AN SGI or I-DEAS System Administrator for help." \ -t "" \ -icon warning exit fi # For location of alchemy executable: # ALCHEMYDIR="/apps/nns_com/fea/bin/alchemy.dir" ALCHEMYDIR="/apps/alchemy/ver1.11" ####### START of Prompt-Control parms ############################### # #ORIENT="LAND" # #ORIENT="PORT" ORIENT="" #COLORIND="BW" #COLORIND="GRAY" #COLORIND="COLOR" COLORIND="" #INVERTYN="NO" #INVERTYN="YES" INVERTYN="" # BACKGRND="BLACK" # BACKGRND="WHITE" BACKGRND="" #BLURLEV="MEDIUM" #BLURLEV="HEAVY" #BLURLEV="NONE" BLURLEV="" # VIEWRGB="/usr/sbin/imgworks" VIEWRGB="/usr/sbin/imgview" #SHORGB="NO" = do not show temp.rgb in imgworks/imgview #SHORGB="" = show temp.rgb in imgworks/imgview SHORGB="" #DPI="300" #DPI="600" #DPI="" DPI="50" # SCALTYP="" SCALTYP="b" #NNS_HPBWTYPE="HPRTL" #NNS_HPBWTYPE="HPPCL" # (RTL is good for ink-jets; PCL better for laser printers) NNS_HPBWTYPE="HPPCL" # ............. Start PRINT PARMS ......................................... #NNS_HPBW_PRINTER="B###_P######" # NNS_HPBW_PRINTER="B600_P140684" # NNS_HPCOLOR_PRTRDESC="B600-1 J-4 near E40" #NNS_HPCOLOR_PRINTER="HP_iaw###" # NNS_HPCOLOR_PRINTER="HP_iaw022" # NNS_HPCOLOR_PRTRDESC="B600-2 M-7 E13" NNS_HPCOLOR_PRINTER="" NNS_HPCOLOR_PRTRDESC="" #NNS_HPBW_PRINTER="B###_P######" # NNS_HPBW_PRINTER="B600_P140684" # NNS_HPBW_PRTRDESC="B600-1 J-4 near E40" #NNS_HPBW_PRINTER="HP_iaw###" # NNS_HPBW_PRINTER="HP_iaw022" # NNS_HPBW_PRTRDESC="B600-2 M-7 E13" NNS_HPBW_PRINTER="" NNS_HPBW_PRTRDESC="" #PRINTYN="NO" = no prompt whether to print AND exit w/o printing #PRINTYN="YES" = no prompt whether to print; go ahead and print #PRINTYN="" = prompt whether to print (YES/NO) PRINTYN="" #PRT_HP_YN="NO" = no warning about HP file print AND exit w/o printing #PRT_HP_YN="YES" = no warning/really-print prompt; print #PRT_HP_YN="" = warn about HP file print & 'really-print?' prompt (YES/NO) PRT_HP_YN="YES" # .............. End PRINT PARMS ......................................... #DELRGB="NO" = no prompt for delete of temp.rgb AND no delete #DELRGB="YES" = no prompt; delete temp.rgb #DELRGB="" = prompt for delete of temp.rgb DELRGB="NO" ####### END of Prompt-Control parms ############################### CHOICES="Choices so far:" CHOICES2=" " ####### Ask for print orientation ######################################## if test "$ORIENT" = "" then ORIENT=`/usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -b LAND -B PORT \ -t "" \ -t "SELECT PRINTOUT ORIENTATION --" \ -t "" \ -t "PORTRAIT OR LANDSCAPE." \ -t "" \ -icon warning` CHOICES=$CHOICES" $ORIENT" fi ####### Set color or gray or black-white indicator ######################### if test "$COLORIND" = "" then COLORIND=`/usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -b BW -b GRAY -B COLOR \ -t " $CHOICES" \ -t "" \ -t "SELECT PLOT COLOR PREFERENCE:" \ -t " 1) COLOR" \ -t " 2) GRAY" \ -t " 3) BW = pure Black-White" \ -t "" \ -t " -- for the HP printer output file." \ -t "" \ -t "NOTE1: GRAY or BW will trigger copying the rgb file to" \ -t "a gray-scale rgb." \ -t "" \ -t "NOTE2: Choosing BW will result in converting gray picture pixels" \ -t "to white on a black background -- or black on a white background." \ -icon warning` CHOICES=$CHOICES" $COLORIND" fi if test \( "$COLORIND" = "BW" -o "$COLORIND" = "GRAY" \) then /usr/sbin/tobw $TEMPRGB $TEMPRGB2 /sbin/rm $TEMPRGB /sbin/mv $TEMPRGB2 $TEMPRGB fi ####### Flip-90 section ################################### # XLIM=8.16i # YLIM=10.66i YLIM=10.16i # CENTER="8.5i 11i" # Offsets seem to have to be in 10s of inches, i.e. use 1/10 of offset inches. # Perhaps it is better to do Offsets in pixels/dots. Ex: -100p 200p # OFFSET="-0.04i 0.10i" # OFFSET="030p 900p" OFFSET="030p 300p" FLIPMSG="" if test "$ORIENT" = "LAND" then /usr/sbin/iflip $TEMPRGB $TEMPRGB2 90 /sbin/rm -f $TEMPRGB /sbin/mv $TEMPRGB2 $TEMPRGB XLIM=8.16i # YLIM=10.66i YLIM=10.16i # CENTER="8.5i 11i" # # XLIM=10.66i # YLIM=8.16i # CENTER="11i 8.5i" # # Offsets seem to have to be in 10s of inches, i.e. use 1/10 of offset inches. # Perhaps it is better to do Offsets in pixels/dots. Ex: -100p 200p # OFFSET="-0.08i 0.07i" # pretty good; too narrow at bottom of landscape # OFFSET="030p 400p" # OFFSET="030p 250p" OFFSET="030p -150p" FLIPMSG="Image has been rotated 90 degrees for landscape print." fi ####### END of Flip-90 section ########################################### ## ####### Zoom-down to within 640x480 ################################### ## # The SHRINK statements and ## # this 'izoom' section could be removed if a 'professional' version of ## # Image Alchemy were licensed, instead of the demo version limited to ## # 640x480 image file input. Ref: nnsFEAmenu opt 'u g a h' ## # ## ## ZOOMMSG="" ## ZOOMMSG2="" ## ## if test ! "$SHRINK" = "1.0" ## then ## ## # /usr/sbin/izoom $TEMPRGB $TEMPRGB2 $SHRINK $SHRINK -i ## # /usr/sbin/izoom $TEMPRGB $TEMPRGB2 $SHRINK $SHRINK -g -w 0.65 ## # /usr/sbin/izoom $TEMPRGB $TEMPRGB2 $SHRINK $SHRINK -m -w 0.65 ## # /usr/sbin/izoom $TEMPRGB $TEMPRGB2 $SHRINK $SHRINK -b -w 0.65 ## /usr/sbin/izoom $TEMPRGB $TEMPRGB2 $SHRINK $SHRINK -q -w 0.65 ## ## /sbin/rm -f $TEMPRGB ## /sbin/mv $TEMPRGB2 $TEMPRGB ## ZOOMMSG="The .rgb capture file was zoomed within 640x480 limits" ## ZOOMMSG2="-- to use the demo/evaluation Alchemy program." ## fi ## ## ####### END of Zoom-down section ########################################### ####### Set 'invert' parm ################################### if test "$INVERTYN" = "" then INVERTYN=`/usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -B NO -b YES \ -t " $CHOICES" \ -t "" \ -t "THE IMAGE HAS BEEN COPIED INTO FILE" \ -t " $TEMPRGB" \ -t "" \ -t "$ZOOMMSG" \ -t "$ZOOMMSG2" \ -t "" \ -t "INVERT THE COLORS IN THE IMAGE? -- in particular," \ -t "change black background to white? YES or NO." \ -t "" \ -t "NOTE: To save ink, BEST TO USE WHITE BACKGROUND" \ -t "rather than black." \ -icon warning` CHOICES=$CHOICES" Invert= $INVERTYN" fi if test "$INVERTYN" = "YES" then if test "$COLORIND" = "COLOR" then /usr/sbin/repcolor $TEMPRGB $TEMPRGB2 0 0 0 255 255 255 0 /sbin/rm $TEMPRGB /sbin/mv $TEMPRGB2 $TEMPRGB fi if test \( "$COLORIND" = "GRAY" -o "$COLORIND" = "BW" \) then # # # NOTE: Choosing 'GRAY' or 'BW' at the color prompt above, # # triggered using 'tobw' to create a black-white .rgb. # /usr/sbin/invert $TEMPRGB $TEMPRGB2 /sbin/rm $TEMPRGB /sbin/mv $TEMPRGB2 $TEMPRGB fi fi ####### CONVERT GRAY-RGB TO BLACK-WHITE -- ############################## ####### using 'imgexp' to map color/gray to white. ###################### if test "$COLORIND" = "BW" then ####### Set 'background' parm ################################### if test "$BACKGRND" = "" then BACKGRND=`/usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -B WHITE -b BLACK \ -t " $CHOICES" \ -t "" \ -t "Is the BACKGROUND in your image going to be" \ -t "BLACK OR WHITE?" \ -t "" \ -t " Your response is used to determine whether GRAYs will be changed to" \ -t " black (for a white background) -- or to white (on black background)." \ -t "" \ -icon warning` CHOICES=$CHOICES" BACKGD= $BACKGRND" fi if test "$BACKGRND" = "BLACK" then /usr/sbin/imgexp $TEMPRGB $TEMPRGB2 0 1 /sbin/rm $TEMPRGB /sbin/mv $TEMPRGB2 $TEMPRGB else /usr/sbin/imgexp $TEMPRGB $TEMPRGB2 254 255 /sbin/rm $TEMPRGB /sbin/mv $TEMPRGB2 $TEMPRGB fi fi ####### 'Blur' (anti-alias) image ####################################### IMGX=`/usr/sbin/imgsize $TEMPRGB | awk '{print $1}'` IMGY=`/usr/sbin/imgsize $TEMPRGB | awk '{print $2}'` if test "$BLURLEV" = "" then BLURLEV=`/usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -B NONE -b MEDIUM -bHEAVY \ -t " $CHOICES" \ -t "" \ -t "BLUR THE IMAGE? -- to attempt to reduce 'jaggies'." \ -t "" \ -t "OPTIONS: NONE, MEDIUM, HEAVY" \ -t "" \ -t "Warning: Blur will reduce the resolution of text and lines." \ -t "But it can soften jaggies on shaded images." \ -t "" \ -icon warning` CHOICES=$CHOICES" Blur= $BLURLEV" fi if test \( "$BLURLEV" = "MEDIUM" -o "$BLURLEV" = "HEAVY" \) then /usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -B DISMISS \ -t "The BLUR OPERATION will take several seconds. Hang on." \ -icon warning & fi if test "$BLURLEV" = "MEDIUM" then /usr/sbin/blur $TEMPRGB $TEMPRGB2 $IMGX $IMGY /sbin/rm $TEMPRGB /sbin/mv $TEMPRGB2 $TEMPRGB fi if test "$BLURLEV" = "HEAVY" then IMGX2=`echo "scale = 10; 0.60*$IMGX" | bc` IMGY2=`echo "scale = 10; 0.60*$IMGY" | bc` /usr/sbin/blur $TEMPRGB $TEMPRGB2 $IMGX2 $IMGY2 /sbin/rm $TEMPRGB /sbin/mv $TEMPRGB2 $TEMPRGB fi ####### Set DPI preference ########################################### if test "$DPI" = "" then DPI=`/usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -B 300 -b 600 -b 200 -b 150 \ -t " $CHOICES" \ -t "" \ -t "SELECT DPI PREFERENCE -- 300 or 600 (or 150 or 200)." \ -t "" \ -t "(Then wait about 20 seconds for a gray HP print file" \ -t " to be created, 60 seconds for color -- much longer for 600 dpi.)" \ -t "" \ -t "(600 or 200 can be used for LaserJet 4, 5, etc. LaserJet 3 and" \ -t " before, and most color Deskjets, should use 300 or 150.)" \ -t "" \ -t " NOTE:" \ -t " After the HP-PCL file (or color HP-RTL file) is created," \ -t " the .rgb file will be shown with 'imgworks' and" \ -t " the HP file can be sent to an HP Laserjet (or Deskjet)." \ -t "" \ -icon warning` CHOICES=$CHOICES" DPI= $DPI" fi ####### Set Scaling preference ########################################### if test "$SCALTYP" = "" then SCALTYP=`/usr/bin/X11/xconfirm -c $WINGEOM \ -header "$WINTITLE" -b d -b c -B b -b a \ -t "$CHOICES" \ -t "" \ -t "SELECT SCALING ALGORITHM." \ -t "" \ -t "a - Nearest Neighbor" \ -t "" \ -t "b - Averaging/Linear-Interpolation (default)" \ -t "" \ -t "c - Lanczos2" \ -t "" \ -t "d - Lanczos3" \ -t "" \ -icon warning` CHOICES=$CHOICES" ScaleType= $SCALTYP" fi ####### Display .rgb file to be converted by Alchemy #################### if test "$SHORGB" = "" then # /usr/sbin/imgworks -nofork $TEMPRGB # /usr/sbin/imgworks $TEMPRGB # /usr/sbin/imgview -geometry +950+000 $TEMPRGB $VIEWRGB -geometry +950+000 $TEMPRGB fi ####### Run Alchemy ########################################### ############################################## # For color images (24-bit SGI-RGB to HP-RTL): ############################################## if test "$COLORIND" = "COLOR" then FILEOUT="/local/scratch/${USER}_temp.rtl" set -x xwsh -bg blue4 -fg white \ -title "$WINTITLE" -name "$WINTITLE" \ -fn -*-screen-medium-r-normal--15-*-*-*-m-80-iso8859-1 \ -geometry 80x18+010+450 -e \ $ALCHEMYDIR/alchemy $TEMPRGB \ $FILEOUT -o \ --r9 -24 \ -X$SCALTYP$XLIM \ -Y$SCALTYP$YLIM \ -D $DPI $DPI \ -+ \ -_ $OFFSET \ -Gi0.4 -Go1.0 \ -ds3 RETCODE=$? set - # -C$ALCHEMYDIR/samples/sample.ucr \ # .ucr gives lots of black with --r13 ; used with -Gi & -Go. # Use -C with type --r2 or --r11, NOT --r13 ?? # Two alternatives for setting size & resolution: # 1) # --X$XLIM \ # --Y$YLIM \ # 2) # -X$SCALTYP$XLIM \ # -Y$SCALTYP$YLIM \ # -D $DPI $DPI \ # -_ $OFFSET \ # The following --_ (centering option) seems to put the picture too low on # the page -- in portrait mode. # --_ $CENTER \ # where CENTER = 8.5i 11i # Typical messages from Alchemy when writing RTL: # # "Writing HP RTL file /local/scratch/bmo01_temp.rtl (output type 9) # Switching to 1 bit CMYK output" # # "The output gamma for a 1 bit, black and white or 4 bit CMYK image # is inherently 1.0. Automatically changing the output gamma to 1.0 # and the input gamma to 0.50 (which will have the requested effect)." # # Alchemy can create 3 different types of RTL: # - CMYK, 1 bit per component per pixel (4 bits/pixel? "4-channel"?) # - 24 bits per pixel # - black & white, 1 bit per pixel # # "Alchemy will generate a color RTL file unless the input file is # black & white or grayscale or the -b option is specified as part # of the conversion." # # "If the input is black & white, you can do the conversion ... with # dithering off. This will result in a faster conversion." # # --r0: Paintjet uncompressed # --r9: Paintjet TIFF compressed # # Other conversion formats are for DesignJet, not DeskJet: # --r1: DesignJet 650C uncompressed # --r2: DesignJet 650C TIFF compressed (default) # # --r6: DesignJet 650C uncompressed, on the fly # --r7: DesignJet 650C TIFF compressed, on the fly # # --r11: DesignJet 650C compressed, 4-channel # --r12: DesignJet 650C compressed, on the fly, 4-channel # # --r13: DesignJet 650C compressed, 24-bit # --r14: DesignJet 650C compressed, on the fly, 24-bit # # "Types 2 and 7 always perform 100% black removal." # "Types 13 and 14 send send 24-bit data to the plotter, allowing it # to perform the RGB to CMYK conversion." # "Types 13 and 14 can be used to scale the image, by specifying a different # DPI value than the 300 DPI value the plotter natively uses." # -ds3 # # -Gi0.6 -Go1.0 # # -_ $OFFSET # -_ 0.0i 0.0i # -_ 100p 100p # # --_ $CENTER # --_ 8.5i 11i # --_ 11i 8.5i # --_ 1250 3300 # --_ 1250p 3300p # # For 24-bit SGI-RGB to color HP-RTL: ############################################################################ # Quantization: Alchemy does no Heckbert quantization when creating # 1-bit CMYK output. So Heckbert quantization parms # -zh# and -zp# are not applicable for .rgb to .rtl conversion. ############################################################################ # Dithering: # -------------------------------------------------------------------------- # -d1 HSI uses Floyd-Steinberg (the default) for 24bit->8bit images # -ds3 HSI suggests Jarvis,Judice,&Ninke (with serpentine) for # color images to black-white and 1bit CMYK (for printer/plotter) ############################################################################ # DPI: # -------------------------------------------------------------------------- # Might need to use '-D 300 300' for HP printers before the Laserjet 4 series ############################################################################ # GAMMA: # -------------------------------------------------------------------------- # Might need to use Gamma parms like the following to compensate # for 'dot gain' (darkness; lots of ink) in printouts: # -Gi0.4 -Go1.0 ############################################################################ NNS_HP_PRINTER=$NNS_HPCOLOR_PRINTER NNS_HP_PRTRDESC=$NNS_HPCOLOR_PRTRDESC NNS_HP_PRTRVAR=NNS_HPCOLOR_PRINTER fi ############################################################### # Set HP-output type (PCL or RTL) for GRAY and BW output modes: # (RTL is good for ink-jets; PCL better for laser printers) ############################################################### if test \( "$COLORIND" = "GRAY" -o "$COLORIND" = "BW" \) then # if test "$NNS_HPBWTYPE" = "HPPCL" # then PCLTYP="53" if test \( "$DPI" = "600" -o "$DPI" = "200" \) then PCLTYP="153" fi GRAYBWPARMS="-P$PCLTYP -b 8 -c2" FILEOUT="/local/scratch/${USER}_temp.pcl" # fi if test "$NNS_HPBWTYPE" = "HPRTL" then # GRAYBWPARMS="--r13 -b -8 -c2" # paletted not supported by --r13 GRAYBWPARMS="--r13 -b" FILEOUT="/local/scratch/${USER}_temp.rtl" fi fi ###################################################### # 24-bit SGI-RGB to GRAY-SCALE 1-bit-per-pixel HP-PCL: ###################################################### if test "$COLORIND" = "GRAY" then set -x xwsh -bg blue4 -fg white \ -title "$WINTITLE" -name "$WINTITLE" \ -fn -*-screen-medium-r-normal--15-*-*-*-m-80-iso8859-1 \ -geometry 80x18+010+450 -e \ $ALCHEMYDIR/alchemy $TEMPRGB \ $FILEOUT -o \ $GRAYBWPARMS \ -X$SCALTYP$XLIM \ -Y$SCALTYP$YLIM \ -D $DPI $DPI \ -+ \ -_ $OFFSET \ -Gi0.4 -Go1.0 \ -ds3 RETCODE=$? set - # -C$ALCHEMYDIR/samples/gray.ucr \ # Gives black image with --r13, even after removing -Gi0.6 -Go1.0 !! # Use -C with type --r2 or --r11, NOT --r13 ?? # Two alternatives for setting size & resolution: # 1) # --X$XLIM \ # --Y$YLIM \ # 2) # -X$SCALTYP$XLIM \ # -Y$SCALTYP$YLIM \ # -D $DPI $DPI \ # -_ $OFFSET \ # UnderColor Removal file for RTL (or PCL): # -C $FEDIR/helps/alchemy_black.ucr \ # Gamma parms for RTL (or PCL): # -Gi0.35 -Go1.0 \ # For RTL output: # --r9 -b -8 -c2 \ # # For use in place of the '--r' line, for PCL output instead of RTL: # -P$PCLTYP -8 -b -c2 \ # The following --_ (centering option) seems to put the picture rather low on # the page -- in portrait mode. # --_ $CENTER \ # where CENTER = 8.5i 11i # NOTE: -d0 (no dithering) causes image to come out black&white (no gray). # Typical messages from Alchemy when writing PCL: # # "Writing HP PCL file /local/scratch/bmo01_temp.pcl (compression type 50)" # # "The output gamma for a 1 bit, black and white or 4 bit CMYK image # is inherently 1.0. Automatically changing the output gamma to 1.0 # and the input gamma to 0.50 (which will have the requested effect)." # -P50 asks for expanded margins (near the edges of the page) # '-P## -8 -b -c256' gets changed by Alchemy to '-P## -8 -b -c2' # "PCL files are always 1-bit black & white files. # Alchemy assumes '-b -c2 -8' when writing a PCL file." # # -P0: uncompressed # -P1: RLE compressed # -P2: TIFF compressed # -P3: Delta Row compressed # # -P0: Portrait # -P10: Landscape # # -P0: Standard margins # -P50: Expanded margins # # -P100: Laserjet4 # # "When converting color or gray-scale images to PCL, you will probably # want to scale the output so the image will be larger than the input # image. This will allow the dithering to preserve more detail in the # image." # # "The best quality dither for PCL output is generally type 3 (Jarvis, # Judice, & Ninke), with a serpentine raster, and some dithering # noise (use -ds3 10, for example)." # # Allowable resolutions by Alchemy PCL: 75, 100 150, 300 DPI # (200 or 600 DPI for Laserjet4) # # If you specify another resolution, Alchemy automatically uses the # next higher resolution. # -_ $OFFSET # -_ 0.0i 0.0i # # --_ $CENTER # --_ 8.5i 11i # --_ 11i 8.5i # --_ 1250p 3300p # --_ 1250 3300 # # For 24-bit to GRAY-SCALE 1-bit HP-PCL: ############################################################################ # Quantization: Alchemy does not seem to do Heckbert quantization when '-b' # is present with the -8 and -c2 parameters -- for # creation of a gray-scale (1-bit) HP-PCL file. So Heckbert # quantization parameters -zh# and -zp# are not applicable # for .rgb to gray-scale (1-bit) HP-PCL conversion. ############################################################################ # If one goes from 24-bit to 8-bit color (-8 -c256), # default quantization-dithering is '-zh0 -zp0 -d1'. # -------------------------------------------------------------------------- # -zh1 (Heckbert quantization method 1) is recommended by HSI when reducing # to small # of colors; default is method 0. # -------------------------------------------------------------------------- # -zp2 specifies 'corner' color-choice method instead of 'mean' (0, the # default). ############################################################################ # Dithering: # -------------------------------------------------------------------------- # -d1 HSI uses Floyd-Steinberg (the default) for 24bit->8bit images # -ds3 HSI suggests Jarvis,Judice,&Ninke (with serpentine) for # color images to black-white and 1bit CMYK (for printer/plotter) ############################################################################ # DPI: # -------------------------------------------------------------------------- # Might need to use '-D 300 300' for HP printers before the Laserjet 4 series ############################################################################ # GAMMA: # -------------------------------------------------------------------------- # Might need to use Gamma parms like the following to compensate # for 'dot gain' (darkness; lots of ink) in printouts: # -Gi0.4 -Go1.0 ############################################################################ NNS_HP_PRINTER=$NNS_HPBW_PRINTER NNS_HP_PRTRDESC=$NNS_HPBW_PRTRDESC NNS_HP_PRTRVAR=NNS_HPBW_PRINTER fi ################################################################# # For color images (24-bit SGI-RGB) to black-white, 1-bit HP-PCL: ################################################################# if test "$COLORIND" = "BW" then set -x xwsh -bg blue4 -fg white \ -title "$WINTITLE" -name "$WINTITLE" \ -fn -*-screen-medium-r-normal--15-*-*-*-m-80-iso8859-1 \ -geometry 80x18+010+450 -e \ $ALCHEMYDIR/alchemy $TEMPRGB \ $FILEOUT -o \ $GRAYBWPARMS \ -X$SCALTYP$XLIM \ -Y$SCALTYP$YLIM \ -D $DPI $DPI \ -+ \ -_ $OFFSET \ -Gi0.6 -Go1.0 \ -d0 RETCODE=$? set - # -C$ALCHEMYDIR/samples/gray.ucr \ # Gives black image with --r13, even after removing -Gi0.6 -Go1.0 !! # Use -C with type --r2 or --r11, NOT --r13 ?? # Two alternatives for setting size & resolution: # 1) # --X$XLIM \ # --Y$YLIM \ # 2) # -X$SCALTYP$XLIM \ # -Y$SCALTYP$YLIM \ # -D $DPI $DPI \ # -_ $OFFSET \ # For RTL output: # --r9 -b -8 -c2 \ # For use in place of the '--r' line, for PCL output instead of RTL: # -P$PCLTYP -8 -b -c2 \ # -ds3 # NOTE: No dithering (-d0) is OK for black-white PCL & RTL and # should be faster. Also pure black-and-white is also # faster without undercover removal file. # # Probably PCL is like RTL: # "If the input is black & white, you can do the conversion ... with # dithering off. This will result in a faster conversion." # The following --_ (centering option) seems to put the picture rather low on # the page -- in portrait mode. # --_ $CENTER \ # where CENTER = 8.5i 11i # -P50 asks for expanded margins (near the edges of the page) # See -P## parm defs in GRAY section above. # -_ $OFFSET # -_ 0.0i 0.0i # # --_ $CENTER # --_ 8.5i 11i # --_ 11i 8.5i # --_ 1250p 3300p # --_ 1250 3300 # # For 24-bit to BLACK-WHITE 1-bit HP-PCL: ############################################################################ # Quantization: Alchemy does not seem to do Heckbert quantization when '-b' # is present with the -8 parameter (and -c2) -- for creation # of a paletted (black-white, 1-bit). Nor does Alchemy # do Heckbert quantization during conversion to 1-bit HP-PCL. ############################################################################ # Dithering: # Probably PCL is like RTL: # "If the input is black & white, you can do the conversion ... with # dithering off. This will result in a faster conversion." # -------------------------------------------------------------------------- # -d1 HSI uses Floyd-Steinberg (the default) for 24bit->8bit images # -ds3 HSI suggests Jarvis,Judice,&Ninke (with serpentine) for # color images to black-white and 1bit CMYK (for printer/plotter) ############################################################################ # DPI: # -------------------------------------------------------------------------- # Might want to use '-D 300 300' for HP printers before the Laserjet 4 series ############################################################################ # GAMMA: # -------------------------------------------------------------------------- # Might want to use Gamma parms like the following to compensate # for 'dot gain' (darkness; lots of ink) in printouts: # -Gi0.6 -Go1.0 ############################################################################ NNS_HP_PRINTER=$NNS_HPCOLOR_PRINTER NNS_HP_PRTRDESC=$NNS_HPCOLOR_PRTRDESC NNS_HP_PRTRVAR=NNS_HPCOLOR_PRINTER fi if test ! $RETCODE = 0 then /usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" -B DISMISS \ -t "$CHOICES" \ -t " $CHOICES2" \ -t "" \ -t "Alchemy returned an error." \ -t "" \ -t "To see messages, you can run this utility -- " \ -t "" \ -t "$0" \ -t "" \ -t "-- in a Unix shell window." \ -t "" \ -icon warning exit fi # ####### If NNS_HP_PRINTER var not set, show how-to-print message ###### # ####### and then exit. ###### # if test "$NNS_HP_PRINTER" = "" # then # # JUNK=`/usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ # -B DISMISS \ # -t "$CHOICES" \ # -t "$CHOICES2" \ # -t "" \ # -t "PROCESS IS COMPLETE. CREATED FILE '$FILEOUT'" \ # -t "" \ # -t "$NNS_HP_PRTRVAR is not set -- in your .profile file or in this script." \ # -t "*** NO PRINT sent now." \ # -t "" \ # -t "You can send the HP print file to an HP-compatible printer" \ # -t "using the Unix lp 'raw' command (or lpr raw queue), like" \ # -t "" \ # -t " lp -c -d -oraw -onobanner $FILEOUT" \ # -t " ( lpr -PBxxx_P##### $FILEOUT )" \ # -t " -OR-" \ # -t "The HP print file can be ftp-ed to a PC LAN (or moved by" \ # -t "diskette/tape to a PC) for printing via the old DOS command:" \ # -t " copy /b filename.rtl lpt1:" \ # -t "to a printer connected to the parallel port on a PC." \ # -t "" \ # -icon warning` # # exit # fi if test "$NNS_HP_PRINTER" = "" then NNS_HP_PRINTERID=`/usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -font Screen15 \ -B NoPlot -b HP_iaw022 -b 140684 \ -t " $CHOICES" \ -t "$CHOICES2" \ -t "" \ -t "Some NNS HP-DeskJet Plotters:" \ -t "" \ -t "lp/lpr-name Location" \ -t "_____________ ________________________________________________________________" \ -t "" \ -t "*B600:" \ -t "" \ -t " HP_iaw022 B600-2 M-6 E13 Subs Electrical" \ -t " B600_P140684 B600-1 I-4 near E40" \ -t "" \ -t "*B160:" \ -t "" \ -t " No B160 DeskJets with a print-server card/box and IP-address" \ -t " on the company network yet." \ -t "" \ -icon warning` fi if test "$NNS_HP_PRINTERID" = "NoPlot" then /usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -b DISMISS \ -t "$CHOICES" \ -t "$CHOICES2" \ -t "" \ -t "The HP-RTL output file is in" \ -t "" \ -t "$FILEOUT" \ -t "" \ -t "You can send the HP plot file to an HP-DeskJet plotter using the" \ -t "Unix 'lpr' command (and a 'P' plot queue, for binary plot files)" \ -t "-- or using the 'lp' command with the 'raw' option." \ -t "Examples:" \ -t " lpr -PBxxx_P##### $FILEOUT " \ -t " lp -dHP_iaw### -oraw -onobanner $FILEOUT " \ -t "" \ -icon warning exit fi NNS_HP_PRINTER="NOT_SET_YET_IN_SCRIPT" case $NNS_HP_PRINTERID in HP_iaw022) NNS_HP_PRINTER=HP_iaw022 ;; 140684) NNS_HP_PRINTER=B600_P140684 ;; esac ####### Do Print-Y/N section, if NNS_HP_PRINTER is set. ################### # if test "$PRINTYN" = "" then PRINTYN=`/usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -b YES -B NO \ -t "$CHOICES" \ -t "$CHOICES2" \ -t "" \ -t "REALLY SEND PLOT FILE to plotter ${NNS_HP_PRINTER} ?" \ -t "" \ -icon warning` fi # if test "$PRINTYN" = "NO" if test ! "$PRINTYN" = "YES" then exit fi ####### END of Print-Y/N section ########################################### # ################ START of section to ######################### # ################ PRINT HP file TO NNS_HP_PRINTER, ######################### # ################ which is set above from ######################### # ################ NNS_HPBW_PRINTER or NNS_HPCOLOR_PRINTER ################# if test ! "$NNS_HP_PRINTER" = "" then # FEDIR=/apps/nns_com/fea NNS_PRTR=$NNS_HP_PRINTER ### For testing: ## NNS_PRTR=B600xxxx ## NNS_PRTR="B600_Pxxxxx" ## NNS_PRTR="HP_iawxxx" ## NNS_PRTR="dumbo" # set -x LPRAW="-oraw" LPNOBANNER="-onobanner" . $FEDIR/scripts/set_prtcmd_bwdesk_noprompts if test ! $RETCODE = 0 then xconfirm -c -header "PRINT - Warning" -B DISMISS \ -t "$PRTQ_TYPE Printer $NNS_PRTR" \ -t "is not defined to this machine, `hostname`." \ -t "Try another printer," \ -t "or call SGI SysAdmins at 8-HELP -- " \ -t "or call an I-DEAS Admin in E40/C61." \ -icon warning exit fi # . $FEDIR/scripts/chk_psprtr # if test ! $RETCODE = 0 # then # exit # fi if test "$PRT_HP_YN" = "" then PRT_HP_YN=`xconfirm -c -header "HP-PRINT - Warning" -b NO -B YES \ -t "This utility prints an HP printer file." \ -t "" \ -t "If the printer you chose ($NNS_PRTR) is not equipped to" \ -t "interpret HP PCL/RTL printer files -- i.e. if the printer" \ -t "is not an HP-compatible printer, it may print many pages" \ -t "of gobbledy-gook instead of a picture on a single page. " \ -t "" \ -t "Do you want to send the print to the printer??" \ -icon warning` fi if test "$PRT_HP_YN" = "NO" then exit fi # set - ### For testing: # echo $NNS_PRT_CMD set -x cat $FILEOUT | $NNS_PRT_CMD # /sbin/rm -f ${TEMPPREF}temp.rgb # /sbin/rm -f $FILEOUT set - fi # ################ END of section to ############################## # ################ PRINT HP file TO NNS_HPBW_PRINTER ######################### # ################ or NNS_HPCOLOR_PRINTER ############################## # ################ Section to delete temp .rgb file ######################### if test "$DELRGB" = "" then ZOOMNOTE="" if test ! "$ZOOMMSG" = "" then ZOOMNOTE="zoomed down" fi DELRGB=`/usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -b NO -B YES \ -t "$CHOICES" \ -t "$CHOICES2" \ -t "" \ -t "DELETE the $ZOOMNOTE .rgb temporary work file ..." \ -t "$TEMPRGB ? (Yes or No)" \ -t "" \ -icon warning` fi if test "$DELRGB" = "YES" then /sbin/rm -f $TEMPRGB fi # ########## End of Section to delete temp .rgb file #########################