Skip to content

Instantly share code, notes, and snippets.

@aemkei
Created May 19, 2009 15:53
Show Gist options
  • Save aemkei/114181 to your computer and use it in GitHub Desktop.
Save aemkei/114181 to your computer and use it in GitHub Desktop.
Export PNG8 With Alpha

Choose your colors:

  • Open original file in Photoshop
  • Select relevant areas (“Marquee”)
  • Choose: Selection > Save Selection…
  • Enter name eg: “Colors” and hit “Save”

Remove transparent areas:

  • Select layer alpha (“CMD+Click” on layer)
  • Switch to Quick Mask mode (Hit “Q”)
  • Choose: Image > Adjustments > Threshold
  • Set “Level” to 255 and “Save”
  • Leave Quick mask mode (Hit “Q”)
  • Choose: Select > Inverse
  • Remove transparent parts (Hit “Backspace”)

Export indexed image:

  • Choose: Save > Save for Web & Devices…
  • Select: PNG 8, Selective, 200 Colors, No Dither
  • Click “Modify Color Reduction…”
  • Choose Channel: “Colors” and hit “Ok”
  • Set Matte to Pink
  • Leave “Interlace” unchecked
  • Check “Transparency”
  • Hit “Save” and name it “sprite_index.png”

Select transparency areas only:

  • Open original file in Fireworks
  • Rename layer to “alpha”
  • Choose: File > Import… “sprite_index.png”
  • Rename layer to “index”
  • Select transparency (“ALT+Click” on indexed layer)
  • Select original layer and remove colors (Hit “Backspace”)
  • Hide “index” layer

Export alpha channel only:

  • Switch to “Preview” mode
  • Select: PNG8, Adaptive, 30 Colors, Dither 0, Alpha Transparency
  • Choose File > Export… and name it “sprite_alpha.png”

Merge indexed and alpha channel:

  • Open “sprite_alpha.png” in Fireworks
  • Choose: File > Import… “sprite_index.png”
  • Choose: File > Save As… and name it “sprite_merged.png”

Quantize merged image:

  • Download pngquant from http://pornel.net/pngquant
  • Put it into your image path
  • Open terminal and run “pngquant sprite_merged.png”
  • Bingo: The result “sprite_merged-fs8.png” is your 8 bit baby!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment