;+ ; NAME: ; wrim ; PURPOSE: (one line) ; Write the contents of a window or device to a graphics file ; CATEGORY: ; Graphics ; CALLING SEQUENCE: ; wrim, filename, im ; INPUTS: ; filename : A string containing the name of file to be written. ; KEYWORD PARAMETERS: ; norm : no rm (if set, do not remove the temporary file) ; PROCEDURE ; At some point (2007 May 8) - write_tiff was not found, so this uses "obsolete" tiff_write ; 2016 July 7 - go back to write_tiff ; 2016 July 7 - this is causing problems with compatability across platforms. Go to write_image ; MODIFICATION HISTORY: ; Written 2008 May 8, by Leslie Young, SwRI ; 2016 Mar 22 LAY. Added header documentation. ;- pro wrim, fn, im, norm = norm format = (strsplit(fn, '.', /extract))[-1] if format eq 'tif' then format = 'tiff' write_image, fn, Format, im ; case 1 of ; strmatch(fn, '*.tif') or strmatch(fn, '*.tiff'): write_tiff, fn, im ; strmatch(fn, '*.png') : write_png, fn, im ; strmatch(fn, '*.bmp') : $ ; if size(im,/n_dim) eq 2 then write_png, fn, im else write_png, fn, reverse(im, 1) ; else begin ; write_tiff, fn+'.tif', im ; spawn, 'convert ' + fn+'.tif ' + fn ; if not keyword_set(norm) then begin ; spawn, 'rm ' + fn + '.tif' ; endif ; endelse ; endcase end