#!/bin/ksh # # Script: hc_idgrfx2psA_prtr in $FEDIR/scripts # where FEDIR=/apps/nns_com/fea # # Motivation: # Uses A=Alchemy rather than 'tops', for hi-quality -- # and for smaller, Alchemy-translated PostScript files (i.e. # for faster printouts and less network traffic). # # Purpose: To provide high quality Postscript *PRINTOUT* (or files) from # an SGI # 1) I-DEAS Master Series (Design or Simulation) Graphics area # of the screen, # or 2) lower-left of that area, # or 3) entire SGI screen (for 'tutorial' screen prints or for # screen print from any application). # # Processing logic: # Uses 'scrsave' (and 'izoom') and 'alchemy' programs -- # to create # 1) color PostScript print file # or 2) gray PostScript print file # or 3) black-white PostScript print file. # # To output BLACK-WHITE images (esp. wireframe/lines/text images), # uses 'imgexp' to convert color/gray to white and, optionally, # uses 'invert' to switch black/white. I.e. end result can be black # design info on a white background. # # To output GRAY-SCALE OR 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 gray or color # design info on a white background. # # Uses 'xconfirm' to ask # 1) what part of screen is wanted # ('IDEASgfx','LowLeft','ALLscrn') # 2) whether a landscape or portrait orientation is wanted # 3) whether a color, gray-scale or black-white Postscript is # wanted # <'scrsave' is executed at this point.> # 4) Invert image? -- esp. black background to white. # 5) DotsPerInch wanted -- 300 or 600 (or 200 or 150). # 6) What type of scaling algorithm to use to scale the raster # image to the 8.16"x10.66" printable area? (a,b,c, or d) # (Using 'b' seems best; de-activated this prompt.) # # Uses 'imgworks' to immediately review the scrsave-created # .rgb file and 'xpsview' to review the alchemy-created .ps file. # # Uses 'xconfirm' to ask whether printout is wanted. If so, # uses NNS_PSBW_PRINTER or NNS_PSCOLOR_PRINTER to determine whether # to print and where to print. # # Note: Instead of putting Postscript files in a /local/scratch --- # the FILEOUT variable below can be set to direct the output file(s) # to $HOME/temp.ps (or $HOME/temp.psg for gray AND $HOME/temp.psc # for color) -- for 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.ps . # # Written by: Blaise Montandon E40/C61 12Mar98 based on hc_idgrfx2gifA # and print routine from hc_idgrfx2rtl_prtr # Updated by: Blaise Montandon E40/C61 17Mar98 add landscape & DPI opts # Updated by: Blaise Montandon E40/C61 18Mar98 add OFFSET opt for portrait # Updated by: Blaise Montandon E40/C61 19Mar98 add 640x480 lowleft opt # Updated by: Blaise Montandon E40/C61 7Apr98 add ALLscrn; improve # SHRINK,izoom opts # Updated by: Blaise Montandon E40/C61 24Apr98 Added 2 yellow horizontal # lines to mark LowLeft area; # Updated by: Blaise Montandon E40/C61 4May98 Added vars at top of script # facilitate setting defaults in copies of this script # Updated by: Blaise Montandon E40/C61 26May98 Separated del-rgb & no-printer # xconfirm msgs # Updated by: Blaise Montandon E40/C61 15Sep98 add chk_retcode_exit calls # after xconfirm calls #ORIENT="LAND" #ORIENT="PORT" ORIENT="" #SCRAREA="ALLscrn" #SCRAREA="IDEASgfx" #SCRAREA="LowLeft" SCRAREA="" #COLORIND="BW" #COLORIND="GRAY" #COLORIND="COLOR" COLORIND="" #NNS_PSCOLOR_PRINTER="tek##" #NNS_PSCOLOR_PRINTER="HP_iaw###" NNS_PSCOLOR_PRINTER="" #NNS_PSBW_PRINTER="B###_P#####" #NNS_PSBW_PRINTER="HP_iaw###" NNS_PSBW_PRINTER="" #PRINTYN="NO" = no prompt whether to print AND exit w/o printing #PRINTYN="YES" = no prompt whether to print; print #PRINTYN="" = prompt whether to print (YES/NO) PRINTYN="" #PRT_PS_YN="NO" = no warning about PS file print AND exit w/o printing #PRT_PS_YN="YES" = no warning/really-print prompt; go ahead and print #PRT_PS_YN="" = warn about PS file print & 'really-print?' prompt (YES/NO) PRT_PS_YN="" #INVERTYN="NO" #INVERTYN="YES" INVERTYN="" #DPI="300" #DPI="600" DPI="" #SHORGB="NO" = do not show temp.rgb in imgworks #SHORGB="" = show temp.rgb in imgworks SHORGB="" #SHOPS="NO" = do not show temporary Postscript (temp.ps*) in xpsview/showps #SHOPS="" = show temporary Postscript (temp.ps*) in xpsview/showps SHOPS="" #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="" WINTITLE="SGIgrafix2ps_prtr" # 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. FEDIR=/apps/nns_com/fea TEMPRGB="/local/scratch/${USER}_temp.rgb" TEMPRGB2="/local/scratch/${USER}_temp.rgb2" # export TEMPRGB ####### 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` . $FEDIR/scripts/chk_retcode_exit $? $0 fi ####### Set LowLeft X-capture-limit ######################################## XPIXLIM="640" XINCHLIM="6.5" if test "$ORIENT" = "LAND" then XPIXLIM="480" XINCHLIM="4.9" fi ####### Indicate the Lower-Left area of IDEASgfx area #################### ####### by drawing lines on the screen. #################### LINERGB="/local/scratch/line3thick.rgb" /usr/sbin/conimg $LINERGB $XPIXLIM 3 255 255 000 /usr/sbin/ipaste -n -o 10 187 $LINERGB /usr/sbin/ipaste -n -o 10 670 $LINERGB /sbin/rm -f $LINERGB ####### Ask for ALLscrn or IDEASgfx or Lower-Left area #################### if test "$SCRAREA" = "" then SCRAREA=`/usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -b ALLscrn -b IDEASgfx -B LowLeft \ -t " Choices so far: $ORIENT" \ -t "" \ -t "CAPTURE (as SGI .rgb file and convert to Postscript file)" \ -t "" \ -t "1) The entire screen area (1280x1024) (~13.0\"x10.4\")" \ -t "" \ -t "--OR--" \ -t "" \ -t "2) The I-DEAS Design/Simulation Graphics area (1067x796) (~10.8\"x8.1\")" \ -t " (the *usual* I-DEAS Graphics area of the screen)" \ -t "" \ -t "--OR--" \ -t "" \ -t "3) LOWER-LEFT 'quarter' of the I-DEAS Graphics area (${XPIXLIM}x480) (~${XINCHLIM}\"x4.9\")?" \ -t "" \ -t "(NOTE:" \ -t " 'Lower-Left' avoids having to zoom captured image down to 640x480" \ -t " for the 'demo' Alchemy program. The zoom fuzzes thin lines" \ -t " & text, esp. one-pixel wide lines & text." \ -t " The two yellow horizontal lines indicate the extent of the Lower-Left" \ -t " box. They can be removed: put mouse cursor on each line & press Esc.)" \ -t "" \ -icon warning` . $FEDIR/scripts/chk_retcode_exit $? $0 fi if test "$SCRAREA" = "ALLscrn" then SCRCORNERS="" SHRINK=".468" if test "$ORIENT" = "LAND" then SHRINK=".375" fi fi if test "$SCRAREA" = "IDEASgfx" then SCRCORNERS="10 1076 190 985" SHRINK=".599" if test "$ORIENT" = "LAND" then SHRINK=".449" fi fi if test "$SCRAREA" = "LowLeft" then SCRCORNERS="10 649 190 669" SHRINK="1.0" if test "$ORIENT" = "LAND" then # SCRCORNERS="10 649 190 669" # SHRINK="0.75" # To avoid having to shrink, changed from 640x480 to 480x640. # SCRCORNERS="10 489 190 829" # To avoid having to shrink and not make capture taller than length, # changed from 640x480 to 480x480. SCRCORNERS="10 489 190 669" SHRINK="1.0" fi fi ####### Set color or gray indicator ################################### if test "$COLORIND" = "" then COLORIND=`/usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -b BW -b GRAY -B COLOR \ -t " Choices so far: $ORIENT $SCRAREA" \ -t "" \ -t "*** THE SCREEN CAPTURE WILL BE PERFORMED AFTER THIS SELECTION. ***" \ -t " (It will take about 10 seconds.) HAVE YOU POSITIONED YOUR MODEL?" \ -t "" \ -t "SELECT COLOR PREFERENCE --" \ -t " 1) COLOR" \ -t " 2) GRAY" \ -t " 3) BW = pure Black-White" \ -t "" \ -t " -- for the Postscript output file." \ -t "" \ -t "NOTE: BW will trigger converting colored-or-gray design-info to white on" \ -t " the black design background. Then you can switch white & black" \ -t " to get .rgb & Postscript files with white background and black info." \ -t "" \ -icon warning` . $FEDIR/scripts/chk_retcode_exit $? $0 fi RGBCOLOR="" if test "$COLORIND" = "BW" then RGBCOLOR="-b" fi # # # For GRAY, rather than capture the screen with 'scrsave -b', one can # # # use the '-8 -b -c256' parms on Alchemy to let Alchemy give nice # # # gray-scale images from a color .rgb file. # # # if test "$COLORIND" = "GRAY" # # then # # RGBCOLOR="-b" # # fi ####### 'Kill' the lines on the screen that indicate #################### ####### the Lower-Left area of IDEASgfx area. #################### ps -ef | grep ipaste | grep -v grep | awk '{ print ($2) }' | \ xargs kill -9 {} 2> /dev/null ####### Create .rgb file #################################################### ####### sleep 5 allows time for xconfirm window to completely disappear ##### ####### and for most 3D GL images to regenerate. ##### /sbin/sleep 5 /usr/sbin/scrsave $TEMPRGB $SCRCORNERS $RGBCOLOR ####### Flip-90 section ################################### # XLIM=8.16i YLIM=10.66i # 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" 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 # 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" 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 ########################################### ####### 'imgexp' color/gray to white ######################################## # # # Choosing 'BW' at the color prompt above, # # triggered 'scrsave -b' to be # # used to capture a black-white .rgb. # # Alternative method of creating black-white .rgb: # /usr/sbin/tobw $TEMPRGB $TEMPRGB2 # /sbin/rm $TEMPRGB # /sbin/mv $TEMPRGB2 $TEMPRGB # if test ! "$COLORIND" = "COLOR" if test "$COLORIND" = "BW" then /usr/sbin/imgexp $TEMPRGB $TEMPRGB2 0 1 /sbin/rm $TEMPRGB /sbin/mv $TEMPRGB2 $TEMPRGB fi ####### Set 'invert' parm ################################### if test "$INVERTYN" = "" then INVERTYN=`/usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -BNO -b YES \ -t " Choices so far: $ORIENT $SCRAREA $COLORIND" \ -t "" \ -t "THE IMAGE HAS BEEN CAPTURED IN FILE" \ -t " $TEMPRGB" \ -t "" \ -t "$ZOOMMSG" \ -t "$ZOOMMSG2" \ -t "" \ -t "INVERT THE COLORS IN THE IMAGE? -- in particular," \ -t "black background to white? YES or NO." \ -t "" \ -icon warning` . $FEDIR/scripts/chk_retcode_exit $? $0 fi if test "$INVERTYN" = "YES" then if test "$COLORIND" = "BW" then /usr/sbin/invert $TEMPRGB $TEMPRGB2 /sbin/rm $TEMPRGB /sbin/mv $TEMPRGB2 $TEMPRGB fi if test \( "$COLORIND" = "COLOR" -o "$COLORIND" = "GRAY" \) then /usr/sbin/repcolor $TEMPRGB $TEMPRGB2 0 0 0 255 255 255 0 /sbin/rm $TEMPRGB /sbin/mv $TEMPRGB2 $TEMPRGB fi fi ####### Set DPI preference ########################################### if test "$DPI" = "" then DPI=`/usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -B 300 -b 600 \ -t "Choices so far: $ORIENT $SCRAREA $COLORIND Invert: $INVERTYN" \ -t "" \ -t "SELECT DPI PREFERENCE -- 300 or 600." \ -t "" \ -t "(Then wait about 20 seconds for a gray Postscript file" \ -t " to be created, 60 seconds for color -- much longer for 600 dpi.)" \ -t "" \ -t "(NOTE:" \ -t " After the Postscript file is created, the captured and" \ -t " transformed .rgb file will be shown with 'imgworks' and" \ -t " the translated Postscript file will be shown with 'xpsview'." \ -t "" \ -t " 'xpsview' gives a VERY ROUGH rendering of the picture. It will" \ -t " look better on paper and will be centered better than shown.)" \ -t "" \ -icon warning` . $FEDIR/scripts/chk_retcode_exit $? $0 fi ####### Set Scaling preference ########################################### SCALTYP="b" # SCALTYP=`/usr/bin/X11/xconfirm -c $WINGEOM \ # -header "$WINTITLE" -b d -b c -B b -b a \ # -t "Chosen so far: $ORIENT $SCRAREA $COLORIND Invert: $INVERTYN DPI: $DPI" \ # -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 "" \ # -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` # # . $FEDIR/scripts/chk_retcode_exit $? $0 ####### Display .rgb file to be converted by Alchemy #################### if test "$SHORGB" = "" then # /usr/sbin/imgworks -nofork $TEMPRGB /usr/sbin/imgworks $TEMPRGB fi ####### Run Alchemy ########################################### ######################################################### # For color images (24-bit SGI-RGB to 24-bit Postscript): ######################################################### if test "$COLORIND" = "COLOR" then # FILEOUT="/local/scratch/${USER}_temp.pscolor" # FILEOUT="/local/scratch/${USER}_temp.psc" FILEOUT="/local/scratch/${USER}_temp.ps" 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 \ /apps/nns_com/fea/bin/alchemy.dir/alchemy $TEMPRGB \ $FILEOUT -o \ -e20 -24 \ -X$SCALTYP$XLIM -Y$SCALTYP$YLIM \ -D $DPI $DPI \ -+ \ -_ $OFFSET \ -Gi0.7 -Go1.0 \ -ds3 RETCODE=$? set - # The following --_ (centering option) may put the picture too low on # the page -- in portrait mode. # --_ $CENTER \ # where CENTER = 8.5i 11i # Typical messages from Alchemy when writing COLOR Postscript: # # "Image Alchemy (v1.10) - Copyright (c) 1990-97, Handmade Software, Inc. # Reading SGI Image file /local/scratch/bmo01_temp.rgb # Writing Enc. PostScript file /local/scratch/bmo01_temp.ps (output type 20) # Saving image..." # # -e0: No preview, Unix newlines, with 'showpage' # -e20: No preview, MS-DOS newlines, with 'showpage' # # -e100: No preview, Unix newlines, no 'showpage' # -e120: No preview, MS-DOS newlines, no 'showpage' # -Gi0.4 -Go1.0 # # -_ $OFFSET # -_ 0.0i 0.0i # -_ 100p 100p # # --_ $CENTER # --_ 8.5i 11i # --_ 11i 8.5i # --_ 1250 3300 # --_ 1250p 3300p # 24-bit SGI-RGB to color Postscript: ############################################################################ # Quantization: Alchemy does no quantization since '-24' does not require # creation of a palette (8-bit, 256 color). So Heckbert # quantization parameters -zh# and -zp# are not applicable # for .rgb to COLOR Postscript 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.6 -Go1.0 ############################################################################ NNS_PS_PRINTER=$NNS_PSCOLOR_PRINTER NNS_PS_PRTRVAR=NNS_PSCOLOR_PRINTER fi ########################################### # Gives fine-grained gray-scale images: # (24-bit SGI-RGB to gray-scale Postscript) ########################################### if test "$COLORIND" = "GRAY" then # FILEOUT="/local/scratch/${USER}_temp.psgray" # FILEOUT="/local/scratch/${USER}_temp.psg" FILEOUT="/local/scratch/${USER}_temp.ps" 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 \ /apps/nns_com/fea/bin/alchemy.dir/alchemy $TEMPRGB \ $FILEOUT -o \ -e20 -8 -b -c256 \ -X$SCALTYP$XLIM -Y$SCALTYP$YLIM \ -D $DPI $DPI \ -+ \ -_ $OFFSET \ -Gi0.7 -Go1.0 \ -ds3 RETCODE=$? set - # 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) may cause image to come out black&white (no gray). # Typical messages from Alchemy when writing GRAY-SCALE Postscript: # # "Image Alchemy (v1.10) - Copyright (c) 1990-97, Handmade Software, Inc. # Reading SGI Image file /local/scratch/bmo01_temp.rgb # Writing Enc. PostScript file /local/scratch/bmo01_temp.ps (output type 20) # Saving image..." # # -e0: No preview, Unix newlines, with 'showpage' # -e20: No preview, MS-DOS newlines, with 'showpage' # # -e100: No preview, Unix newlines, no 'showpage' # -e120: No preview, MS-DOS newlines, no 'showpage' # -e20 asks for MS-DOS end-of-line characters (add carr-retuns at line-feeds) # -_ $OFFSET # -_ 0.0i 0.0i # # --_ $CENTER # --_ 8.5i 11i # --_ 11i 8.5i # --_ 1250p 3300p # --_ 1250 3300 # # For SGI-RGB to gray-scale Postscript: ############################################################################ # Quantization: Alchemy does not seem to do Heckbert quantization when '-b' # is present with the -8 and -c256 parameters -- for # creation of a palette (8-bit, 256 grays). So Heckbert # quantization parameters -zh# and -zp# are not applicable # for .rgb to GRAY-SCALE Postscript 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.6 -Go1.0 ############################################################################ NNS_PS_PRINTER=$NNS_PSBW_PRINTER NNS_PS_PRTRVAR=NNS_PSBW_PRINTER fi ############################################################## # For color images (24-bit SGI-RGB) to black-white Postscript: ############################################################## if test "$COLORIND" = "BW" then # FILEOUT="/local/scratch/${USER}_temp.psbw" FILEOUT="/local/scratch/${USER}_temp.ps" 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 \ /apps/nns_com/fea/bin/alchemy.dir/alchemy $TEMPRGB \ $FILEOUT -o \ -e20 -8 -b -c2 \ -X$SCALTYP$XLIM -Y$SCALTYP$YLIM \ -D $DPI $DPI \ -+ \ -_ $OFFSET \ -Gi0.7 -Go1.0 \ -d0 RETCODE=$? set - # -ds3 # NOTE: No dithering (-d0) is OK for black-white PS & should be faster.(?) # # Probably to-Postscript is like to-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 # Typical messages from Alchemy when writing BLACK-WHITE Postscript: # # "Image Alchemy (v1.10) - Copyright (c) 1990-97, Handmade Software, Inc. # Reading SGI Image file /local/scratch/bmo01_temp.rgb # Writing Enc. PostScript file /local/scratch/bmo01_temp.ps (output type 20) # Saving image..." # # -e0: No preview, Unix newlines, with 'showpage' # -e20: No preview, MS-DOS newlines, with 'showpage' # # -e100: No preview, Unix newlines, no 'showpage' # -e120: No preview, MS-DOS newlines, no 'showpage' # -e20 asks for MS-DOS end-of-line characters (add carr-retuns at line-feeds) # -_ $OFFSET # -_ 0.0i 0.0i # # --_ $CENTER # --_ 8.5i 11i # --_ 11i 8.5i # --_ 1250p 3300p # --_ 1250 3300 # # For 24-bit to BLACK-WHITE Postscript: ############################################################################ # 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). ############################################################################ # 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.6 -Go1.0 ############################################################################ NNS_PS_PRINTER=$NNS_PSCOLOR_PRINTER NNS_PS_PRTRVAR=NNS_PSCOLOR_PRINTER fi if test ! $RETCODE = 0 then /usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" -B DISMISS \ -t "You Chose: $ORIENT $SCRAREA $COLORIND Invert: $INVERTYN" \ -t " DPI: $DPI" \ -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 # ################ Section to show Postscript file ######################### if test "$SHOPS" = "" then # /usr/bin/X11/xpsview -igc $FILEOUT & # /usr/bin/X11/showps -igc -sc 1.0 -repsf -wp -ps letter -maxp 10m $FILEOUT /usr/bin/X11/showps -igc -sc 0.8 -ps letter $FILEOUT & # /usr/sbin/imgworks -nofork $TEMPRGB (moved above) fi # ####### If NNS_PS_PRINTER var not set, show how-to-print message ###### # ####### and then exit. ###### if test "$NNS_PS_PRINTER" = "" then JUNK=`/usr/bin/X11/xconfirm -c $WINGEOM -header "$WINTITLE" \ -B DISMISS \ -t "You Chose: $ORIENT $SCRAREA $COLORIND Invert: $INVERTYN DPI: $DPI" \ -t "" \ -t "PROCESS IS COMPLETE." \ -t "CREATED FILE '$FILEOUT'" \ -t "" \ -t "$NNS_PS_PRTRVAR is not set in your .profile file. Not printing now." \ -t "" \ -t "You can send the Postscript file to a Postscript-capable 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 Postscript 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.ps lpt1:" \ -t "to a printer connected to the parallel port on a PC." \ -t "" \ -icon warning` exit fi ####### Print-Y/N section, if NNS_PS_PRINTER is set. ######################## # if test "$PRINTYN" = "" then PRINTYN=`/usr/bin/X11/xconfirm -c -header "$WINTITLE" \ -B YES -b NO \ -t "Choices: $ORIENT $SCRAREA $COLORIND Invert: $INVERTYN DPI: $DPI" \ -t "" \ -t "PRINT TO ${NNS_PS_PRTRVAR} = ${NNS_PS_PRINTER} ?" \ -t "" \ -icon warning` . $FEDIR/scripts/chk_retcode_exit $? $0 fi if test "$PRINTYN" = "NO" then exit fi ####### END of Print-Y/N section ########################################### # ################ START of section to ############################## # ################ PRINT PS TO NNS_PS_PRINTER, ############################## # ################ which is set above from ############################## # ################ NNS_PSBW_PRINTER or NNS_PSCOLOR_PRINTER ################## if test ! "$NNS_PS_PRINTER" = "" then # FEDIR=/apps/nns_com/fea NNS_PRTR=$NNS_PS_PRINTER ### For testing: ## NNS_PRTR=B600xxxx ## NNS_PRTR="B600_Pxxxxx" ## NNS_PRTR="HP_iawxxx" # 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_PS_YN" = "" then PRT_PS_YN=`xconfirm -c -header "PS-PRINT - Warning" -b NO -B YES \ -t "This utility prints a Postscript file." \ -t "" \ -t "If the printer you chose ($NNS_PRTR) is not equipped with" \ -t "a Postscript interpreter, it may print many pages of" \ -t "gobbledy-gook instead of a picture on a single page. " \ -t "" \ -t "Do you want to send the print to the printer??" \ -icon warning` . $FEDIR/scripts/chk_retcode_exit $? $0 fi if test "$PRT_PS_YN" = "NO" then exit fi # set - ### For testing: # echo $NNS_PRT_CMD set -x cat $FILEOUT | $NNS_PRT_CMD # rm -f ${TEMPPREF}temp.rgb # rm -f $FILEOUT set - fi # ################ END of section to ############################## # ################ PRINT PS TO NNS_PSBW_PRINTER ############################## # ################ or NNS_PSCOLOR_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 "You Chose: $ORIENT $SCRAREA $COLORIND Invert: $INVERTYN DPI: $DPI" \ -t "" \ -t "DELETE the $ZOOMNOTE .rgb temporary work file ..." \ -t "$TEMPRGB ? (Yes or No)" \ -t "" \ -icon warning` . $FEDIR/scripts/chk_retcode_exit $? $0 fi if test "$DELRGB" = "YES" then /sbin/rm -f $TEMPRGB fi # ########## End of Section to delete temp .rgb file #########################