Sprite: JPG & GIF support. Refactorings