Creating CSS sprites from Photoshop


Question

I have a PSD with a web design.
Every time I tweak the design, I need to manually copy different portions of the image, with different layer visibilities (for transparency) into CSS sprites.

How much can that be automated?

1
14
1/5/2011 10:36:00 PM

Accepted Answer

I used an automatic photoshop script once and worked well.

The concept is :

  • Each portion is a different image.
  • Each portion (and so, each images) must be in the same folder w/o any other images.
  • Run the script indicating the folder and some parameters (size, css name, etc...).
  • The script does :

    1. Merge all images into one with the size you indicated.
    2. Generate the CSS file

In your case, if you modify one image, you regenerate the global image and the CSS via the script and... that's it. Maybe you'll need to copy/paste the CSS in yours if you don't want to use the generated one.

Notes :

I tried it with a few files and worked great. Then, I tried like ~600 pictures and then, you'll need a goooood CPU and patience ;) In this case, don't use it.

9
1/6/2011 9:19:00 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow


Website under construction!!!
^