PRO write_eps,fname,A,TRUE=true,_EXTRA=extra IF N_PARAMS() LT 2 THEN MESSAGE,'TWO PARAMETERS REQUIRED' IF N_ELEMENTS(true) LE 0 THEN BEGIN s=SIZE(A) IF s[0] NE 2 THEN MESSAGE,'INDEX IMAGE ARRAY MUST BE 2D' set_plot,'ps' DEVICE,filename=fname,/color,/encapsulated,bits=8,XSIZE=s[1]/100.,YSIZE=s[2]/100.,PREVIEW=1,_EXTRA=extra TV,A DEVICE,/CLOSE SET_PLOT,'WIN' ENDIF IF KEYWORD_SET(true) THEN BEGIN CASE true OF 1: BEGIN s=SIZE(A) IF s[0] NE 3 THEN MESSAGE,'TRUE COLOR IMAGE ARRAY MUST BE 3D' IF s[1] NE 3 THEN MESSAGE,'TRUE=1 REQUIRES [3,N,M] STACKING OF COLOR ARRAY' tvlct,r1,g1,b1,/get ;Save the color table loadct,0,/silent ;Set to monochrome gray color table set_plot,'ps' DEVICE,filename=fname,/encapsulated,bits=8,XSIZE=s[2]/100.,YSIZE=s[3]/100.,PREVIEW=1,_EXTRA=extra TV,A,TRUE=1 DEVICE,/CLOSE SET_PLOT,'WIN' tvlct,r1,g1,b1 ;Restore the color table END 2: BEGIN s=SIZE(A) IF s[0] NE 3 THEN MESSAGE,'TRUE COLOR IMAGE ARRAY MUST BE 3D' IF s[2] NE 3 THEN MESSAGE,'TRUE=2 REQUIRES [N,3,M] STACKING OF COLOR ARRAY' tvlct,r1,g1,b1,/get ;Save the color table loadct,0,/silent ;Set to monochrome gray color table set_plot,'ps' DEVICE,filename=fname,/encapsulated,bits=8,XSIZE=s[1]/100.,YSIZE=s[3]/100.,PREVIEW=1,_EXTRA=extra TV,A,TRUE=2 DEVICE,/CLOSE SET_PLOT,'WIN' tvlct,r1,g1,b1 ;Restore the color table END 3: BEGIN s=SIZE(A) IF s[0] NE 3 THEN MESSAGE,'TRUE COLOR IMAGE ARRAY MUST BE 3D' IF s[3] NE 3 THEN MESSAGE,'TRUE=3 REQUIRES [N,M,3] STACKING OF COLOR ARRAY' tvlct,r1,g1,b1,/get ;Save the color table loadct,0,/silent ;Set to monochrome gray color table set_plot,'ps' DEVICE,filename=fname,/encapsulated,bits=8,XSIZE=s[1]/100.,YSIZE=s[2]/100.,PREVIEW=1,_EXTRA=extra TV,A,TRUE=3 DEVICE,/CLOSE SET_PLOT,'WIN' tvlct,r1,g1,b1 ;Restore the color table END ENDCASE ENDIF END