Ah, good point.  Perhaps it makes sense then to at least choose the most common format as our base image, i.e. jpg?

Also, thinking through this again, your approach has another advantage: if resize is called every time, we can also specify the thumb size (the thumb_size gallery variable).  That way, if someone has setup their gallery to use 100x100 thumbnails, they get downsized properly.