Here's an explanation of making a black & white animated GIF
movie. I recommend you don't put the animated GIFs directly
on a web page; rather, have a non-animated image that someone
can click on to load in the animated GIF. There are two good
reasons for this: (1) The animated GIF files can be very big
(1 MB or more sometimes) and thus would make your page load
extremely slowly, and (2) some people don't like animated GIFs
and you don't want someone looking at your research page to
get annoyed at you and stop reading.
Note that all of this was developed for Linux; the key routine is the public domain utility gifsicle. Apparently there is a Windows version of this, from the same location, but I have not tested the IDL routines below in Windows. Also, the IDL routine I wrote calls some built-in Linux functions to handle GIF files as the latest versions of IDL don't support GIF. |
IDL> help,a A BYTE = Array[320, 240, 100]So, "a" is a 100 image stack of 320 x 240 pixel images.
IDL> bw_animgif,a,'filename'The filename is arbitrary. Click here to download bw_animgif.pro. You'll also need writetifs.pro and int2ext2.pro. Weeks Lab people, these are already installed.
run gifsicle command: $gifsicle -lforever --colors 256 *.gif > anim.gifJust cut and paste that 2nd line into your IDL window. This makes a file "anim.gif" which is the animated GIF. You can call it something else besides anim.gif. As a byproduct, you will also have created a bunch of files called filename0001.gif, filename0002.gif -- you can often grab one of these to use as your linking image on your main web page. In other words, your HTML code will be something like:
<a href="my_anim.gif"><img src="filename0001.gif"></a>so thus you'll have a still image which links to your movie. You may want to remove the temporary files when you're done (all the rest of the filename0003.gif type files).
IDL> b=bytscl(a(0:99,20:39,*)) IDL> c = small(b) IDL> bw_animgif,c,'movie'This would create a contrast-enhanced cropped movie, with the 'small' command making it half-size. I did something like this to make these movies here. Click here to download small.pro.
IDL> bw_animgif,a,'movie',/gif,header=10I've done this for some movies.
IDL> c=a-(a mod 5) IDL> w=where(c lt 50) IDL> c(w)=0b IDL> bw_animgif,c,'blah'
The first line takes the original image stack "a", and makes sure that all the colors are a multiple of 5, in other words, uses one fifth the shades of grey of the original image. The 2nd & 3rd lines say that anything darker than 50b is set to zero; this is usually OK, although it depends on your image. 255b is the maximum (white) and often anything less than 50b is close enough to black that making it black doesn't ruin the image quality. Try different numbers for lines 1 & 2 and see how the image quality is, compared with the file size. I did tricks like this for this foam movie here. Click here to learn about this movie.
Let me know if you have any questions. At some point I will
write a routine that does animated GIFs in color and post
instructions here.
--Eric