According to this stackoverflow question, there is a program called imagemagick that might do this for you server side but it would probably be outside of WordPress. Otherwise, it looks like you have to shrink every frame and then put it all back together.