;+ ;NAME: ; SAVESCREEN ;PURPOSE: ; Save the current IDL graphics window as a color JPEG image. ;CALLING SEQUENCE: ; savescreen [, name=name] [, date=date] ;OPTIONAL INPUT KEYWORDS: ; NAME: Filename for the image. The .jpg suffix is applied ; automatically. If NAME is not supplied, then "savescreen" ; is the default. ; DATE: If set, then apply a datestamp of the form yyyymmddhhmmss ; to the filename, between the stem NAME and the .jpg suffix. ;MODIFICATION HISTORY: ; 2006-May-31 C. Kankelborg ; 2006-Jun-12 C. Kankelborg, fixed bug which put spaces into filenames ; on single-digit days of the month. Now a leading zero is generated. ; 2006-Jun-20 C. Kankelborg, fixed bugs in previous bug fix. pro savescreen, name=name, date=date if n_elements(name) eq 0 then name="savescreen" if keyword_set(date) then begin ;Append timestamp string to the filename d = systime() year = strmid(d, 20, 4) month = strmid(d, 4, 3) dom1 = strmid(d, 8, 1) ;first digit day of month if (dom1 eq " ") then dom1 = '0' ;convert leading space to leading zero dom2 = strmid(d, 8, 1) ;second digit day of month hour = strmid(d, 11, 2) min = strmid(d, 14, 2) sec = strmid(d, 17, 2) name = name+year+month+dom1+dom2+hour+min+sec endif ;Save plot image img = tvrd(true=3) write_jpeg, name+".jpg", img, true=3, quality=85 end