X
44 Rate this article:
No rating

Internal: Printing an image with customized gray scale color table on B&W Postscript Printer

Anonym

Topic:

Is it possible to print an image with a customized color table on a black & white PostScript printer?

Discussion:

Yes, by translating the defined color table to a black and white table. The following example prints an image with a given color table on a black & white printer (assuming the color table is already defined).

Solution:

;Get the current color table by declaring the COLORS common block or by using TVLCT:
   COMMON COLORS, r, g, b
;or
   TVLCT, r, g, b, /GET
; Translate and scale the color table to a B&W version using the NTSC color to B&W equation:
   bwtable = BYTSCL(.3*r + .59*g + .11*b)
;Set plotting to the PostScript device:
   SET_PLOT, 'printer'  
;Set the PS device to 8 bits per pixel for full greyscale:
   DEVICE, BITS_PER_PIXEL = 8,
;Display the image with the B&W table:
   TV, bwtable (image)
;Close the new PostScript file:
   DEVICE, /CLOSE
set_plot,'x'