Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Way to Sprite Images?

I am now getting to the point that I want to sprite the images on www.trailbehind.com.

Most of the images are loaded by JavaScript functions, and I have lots of little images such as the map icons.

Is there any software that supports this? I know that you can use Django-sprites if your images are in Django templates. And you can use GWT similarly, if you want to write some Java code.

What's the best way to go about this for a website that is Python/Django with a Javascript front-end? I never show any HTML unless the user has JavaScript turned off.

like image 727
Andrew Johnson Avatar asked Jun 01 '09 00:06

Andrew Johnson


People also ask

Should I use image sprites?

An image sprite is a collection of images put into a single image. A web page with many images can take a long time to load and generates multiple server requests. Using image sprites will reduce the number of server requests and save bandwidth.

How do I turn a picture into a sprite?

This tool does it all for you, just drag and drop all your images onto the canvas, that's all you need to do, after you've finished adding all your images, click the "Download Sprite Sheet" button. Drag and drop as many images as you need. Sprite sheets are used to combine multiple images into a single image.

Can a sprite be a PNG?

The Sprite is a image used in design, the file format doesn't matter, but in most cases it's used as PNG or GIF, because of the transparent background.


2 Answers

You can also use Glue. It's an open-source command line tool to generate css sprites.

like image 195
Jorge Bastida Avatar answered Oct 11 '22 15:10

Jorge Bastida


There is an online sprite generator. This can help the process greatly.

like image 33
alex Avatar answered Oct 11 '22 16:10

alex