; ; Written by Martin Haynes (martin.haynes@warwick.ac.uk) ; ; Copy this file to where you normally run IDL, run idl and type '.r animgen' ; ; Initialise, enter here all the startup commands you need eg. ; ; .r plot ; ; also any other commands you need to run before creating the first ; frame PRO animgen loadct,3 x = (indgen(256) - 128) # replicate(1.0,256) ; Set the resolution, don't change the window size while the script is running xres = 800 yres = 600 window,xsize=xres,ysize=yres ; Set the directory where the jpegs are to be outputted, set to '.' for here imagedir = '.' fileprefix = 'snap' ; Set the start and end frame number (both must be less than 9999) imgstart = 1 imgend = 10 ; This loop outputs each frame FOR framenumber = imgstart, imgend DO BEGIN ; load in / generate your data for this frame number y = SIN(2.0*3.14 * x/256.0 + 2.0*3.14 * FLOAT(framenumber) / 10.0) ; plot the data to the screen contour,y,nlevels=40,/fill,/xsty,/ysty ; this next bit writes out the jpeg. snapshot = TVRD() TVLCT, r, g, b, /Get print, 'Frame: ',framenumber ii = framenumber ; work out file name to read for snapshot thousands = FIX(ii/1000) hundreds = FIX((ii-(thousands*1000))/100) tens = FIX((ii-hundreds*100-thousands*1000)/10) ii = ii - thousands*1000 - hundreds*100 - tens*10 units = ii-FIX(ii/10) a = STRTRIM(string(thousands), 2)+STRTRIM(string(hundreds), 2) a = a + STRTRIM(string(tens), 2)+STRTRIM(string(units), 2) file = imagedir + '/' + fileprefix + a + '.jpg' image24 = BytArr(3, xres, yres) image24[0,*,*] = r[snapshot] image24[1,*,*] = g[snapshot] image24[2,*,*] = b[snapshot] write_jpeg,file,image24,true=1,quality=100 ENDFOR END animgen END