Skip to content

Instantly share code, notes, and snippets.

Working on @aseprite / @igarastudio

David Capello dacap

Working on @aseprite / @igarastudio
View GitHub Profile
dacap / Export Opaque Sprite Sheet.lua
Last active Feb 9, 2021
Export a sprite sheet keeping the background opaque for indexed sprites
View Export Opaque Sprite Sheet.lua
local spr = app.activeSprite
if not spr then return print("No active sprite") end
if app.activeSprite ~= spr and
spr.backgroundLayer and
spr.colorMode == ColorMode.INDEXED then
local oldColor = app.bgColor
app.bgColor = Color(spr.transparentColor)
app.bgColor = oldColor
dacap / Select All Frames.lua
Created Jan 22, 2021
Select all frames in the Aseprite timeline
View Select All Frames.lua
local spr = app.activeSprite
if not spr then return print("No active sprite") end
local frames = {}
for i=1,#spr.frames do
frames[i] = i
app.range.frames = frames
dacap / Swap Opacity.lua
Created Dec 16, 2020
Little Aseprite script to swap the opacity value with an alternative value specified in a floating dialog
View Swap Opacity.lua
if opacitydlg then
local toolPref = app.preferences.tool(app.activeTool)
local newValue = = { opacity=toolPref.opacity }
toolPref.opacity = newValue
local dlg = Dialog{ title="Swap Opacity", onclose=function() opacitydlg=nil end }
dlg:slider{ id="opacity", min=0, max=255, value=app.preferences.tool(app.activeTool).opacity/2 }
dacap / export-palette.lua
Created Nov 11, 2020
Export the palette of the active sprite to STDOUT as a C array
View export-palette.lua
-- Usage: aseprite.exe -b my-sprite.aseprite -script export-palette.lua
-- Or from the UI you will see the output in a console that you can copy with Ctrl+C
local spr = app.activeSprite
if not spr then return print("No active sprite") end
local pal = spr.palettes[1]
print("const char palette[] = {")
dacap / Copy-Frames-From-Files.lua
Created Nov 11, 2020
Aseprite script to copy multiple sprites into the active one (each sprite as a layer)
View Copy-Frames-From-Files.lua
local filenames = {
local spr = app.activeSprite
if not spr then return app.alert "No active sprite" end
for _,fn in ipairs(filenames) do
dacap / New Sprite with Preset.lua
Last active Sep 22, 2020
Create new sprite quickly
View New Sprite with Preset.lua
local s = Sprite(256, 256, ColorMode.RGB)
s:setPalette(Palette{ fromResource="DB32" })
dacap /
Last active Sep 17, 2020
open/close commands // or how to never write "xdg-" or "kill -9" again
#! /bin/bash
# open file/folder/url
if [[ "$(uname)" =~ "Darwin" ]] ; then
true # do nothing because macOS already have "open" command
elif [[ "$(uname)" == "Linux" ]] ; then
alias open=xdg-open
alias open=start
dacap / ctrl-space.aseprite-keys
Created Aug 21, 2020
Ctrl+Space to zoom on Aseprite
View ctrl-space.aseprite-keys
<?xml version="1.0" encoding="utf-8" ?>
<keyboard version="1">
<commands />
<tools />
<key tool="zoom" shortcut="Ctrl+Space" />
<actions />
<wheel />
View handy-compile.el
;; ==================================================
;; handy-compile (redefined)
;; ==================================================
(require 'bookmark)
(defun handy-current-buffer-path ()
((buffer-file-name) (file-name-directory (buffer-file-name)))
((eq major-mode 'dired-mode) (dired-current-directory))
dacap / Switch Both Layers.lua
Created Jan 29, 2020
Switches the visibility of two layers (Back/Front) at the same time
View Switch Both Layers.lua
-- Switches the visibility of the active layer, if the layer is called
-- "Something Back" or "Something Front", it will try to switch the
-- visibility of the other layer "Something Back/Front" too (so you
-- can switch the visibility of two layers at the same time).
local layer = app.activeLayer
if not layer then
return app.alert "There is no active layer"