;+ ; NAME srf2jpg.pro ; ; PURPOSE Convert Sun Raster images to JPEG format. ; ; SYNTAX srf2jpg, srf_list ; ; HISTORY Andrew L. Stanger HAO/NCAR 27 September 2001 ;- pro srf2jpg, srf_list, disp=disp CLOSE, 11 srf_name = '' xdim_prev = 0 ydim_prev = 0 red = bindgen (256) green = red blue = red ;--- File list loop. OPENR, 11, srf_list WHILE (NOT EOF (11)) DO $ BEGIN ;{ ;--- Read FITS image header & pixel data. READF, 11, srf_name ; Get file name. PRINT, 'srf image : ', srf_name READ_SRF, srf_name, srf_img, red, green, blue imgsz = SIZE (srf_img) xdim = imgsz [1] ydim = imgsz [2] ;--- Convert to byte pixels. ;--- Display image. IF (KEYWORD_SET (disp)) THEN $ BEGIN ;{ TVLCT, red, green, blue IF (xdim NE xdim_prev OR ydim NE ydim_prev) THEN $ WINDOW, xsize=xdim, ysize=ydim TV, srf_img ; Display image. END ;} jpg_img = BYTARR (xdim, ydim, 3) jpg_img [*, *, 0] = red [srf_img [*, *]] jpg_img [*, *, 1] = green [srf_img [*, *]] jpg_img [*, *, 2] = blue [srf_img [*, *]] ;--- Write new image to disk. sloc = RSTRPOS (srf_name, '.srf') new_name = STRMID (srf_name, 0, sloc) + '.jpg' PRINT, 'sloc: ', sloc PRINT, 'jpg image : ', new_name WRITE_JPEG, new_name, jpg_img, true=3, quality=75 ; Write new image. xdim_prev = xdim ydim_prev = ydim END ;} CLOSE, 11 END