Skip to content

Instantly share code, notes, and snippets.

@dacap
Last active February 9, 2021 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dacap/e7d85ebd2de17eb31509e926af14e9a5 to your computer and use it in GitHub Desktop.
Save dacap/e7d85ebd2de17eb31509e926af14e9a5 to your computer and use it in GitHub Desktop.
Export a sprite sheet keeping the background opaque for indexed sprites
local spr = app.activeSprite
if not spr then return print("No active sprite") end
app.command.ExportSpriteSheet()
if app.activeSprite ~= spr and
spr.backgroundLayer and
spr.colorMode == ColorMode.INDEXED then
local oldColor = app.bgColor
app.bgColor = Color(spr.transparentColor)
app.command.BackgroundFromLayer()
app.bgColor = oldColor
app.command.SaveFile()
app.command.CloseFile()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment