Made a script to display the total number of non-empty cels from visible layers. Or, in naive terms, the total frame count.
It’s ugly but it works.
-- Made 2021/01/17 00:32-02:14 by Unknow0059. For version of commit 9f88508 and higher.
tally = 0
for index, layer in ipairs(app.activeSprite.layers) do
if layer.isVisible then
for index, cel in ipairs(layer.cels) do
if not cel.image:isEmpty() then
tally = tally + 1
end
end
end
end
app.alert(tostring(tally))
Hi everyone, thanks for all these scripts. I’m having trouble finding one that does the exact thing I need, or knowing the terminology for it…
Is there a script that can scan an indexed color image and tell me if I’ve used more than X palette colours in a single pixel height horizontal line? I’m working on Amiga copper backdrops and have a 3 colours (+ transparent/black) per line limitation to work around and it’s surprisingly difficult to do it by eye. Even better if it could highlight the lines somehow?
Here try this script: eg_palrowmax.lua - Google Drive
You may edit value of MAX_COLORS_IN_ROW at 5th row inside script if you want some other max count.
… I don’t quite understand how it works, sorry! haha,. When I run it in file/scripts it pops up “All OK!” but i don’t know if it did anything… It says All OK! whatever picture I try it on? I’m maybe doing it wrong. I’m on Aseprite 1.2.27
Oh, I forgot to mention. You should prefix your layers with + sign or # sign for it to be checked. It checks all frames of all layers prefixed that way.
非常感谢,我在为自己的游戏项目写一个lua脚本用于导出图片和数据的时候遇到了问题,在参考了“Export sprite’s layers as individual images”中的lua脚本后,我解决了我的问题。我向此作者表达了感谢,也感谢你的整理的列表。
Thank you very much. I had a problem writing a Lua script for exporting images and data for my game project. I solved my problem by referring to the Lua script in “Export Sprite’s Layers as Individual Images”. I express my thanks to the author and thank you for compiling this list.
I just made a helpful color range selection script. It lets you select colors continuously instead of one-by-one like you had to do with the built-in tool: select-> color range.
I’m calling this one SCMRSN (pronounced “Scrimson”) and plan to release a CRMSN version later.
are there any extensions that can modify the duration of a specific cel or layer? I’ve been trying to change the frame rate per layer but it turns out, it also change the cels that’s within that Frame.
So, when I first came across this thread several months ago, I tried to download among other things this script. Unfortunately, the link to GitHub was and still is dead. I went to author’s twitter, ask them for a working one and got it!
Since then the author privated their twitter. So the script became inaccessible again.
Which is why I uploaded the file to my GDrive in case anyone needs it.
Hey guys, I created a simple “noise” script. GIMP has something similar, and I was missing it in Aseprite.
By default, it will create a new layer and scatter it with single pixel dots in your current foreground color. You can control the density with the first script option (higher numbers = LOWER density).
Even better, if you want to create noise using a brush, all you have to do is choose the “Use current brush” checkbox and the script will apply the brush anywhere it would have created a speck of noise.
I apologize for not updating this list recently, as I’ve been quite busy lately. However, I wanted to share a small Aseprite script I just finished working on. It allows you to import images from a folder into new layers.
I suspect that the problem is that you downloaded the file as “html”, and not as “lua”.
Please, try downloading it from here: Bitbucket
Click that link > Click on the 3 points at the top right > right click on “open raw” > save link as “import_images_as_layers.lua”
If it still doesn’t work, please create a .lua file (you can use notepad++ for example) and paste this code inside:
-- Aseprite script: Import images as layers
-- Author: JJHaggar
-- Generated with the assistance of an AI model
-- License: CC0 1.0 Universal
-- https://creativecommons.org/publicdomain/zero/1.0/
-- Prompts the user to select a file
local dlg = Dialog("Select file")
dlg:label{
id = "instructions_label",
label = "Instructions: ",
text = "Select an image in the folder that contains all the images you want to add as layers"
}
dlg:file{
id = "file",
label = "File:",
open = true,
save = false,
onchange = function(file) dlg:modify{id="file", text=file} end
}
dlg:button{ id = "ok", text = "OK" }
dlg:show()
-- Extracts the directory path of the selected file
local file = dlg.data.file
local dir = app.fs.filePath(file)
-- Gets a list of files in the selected directory
if app.fs.isDirectory(dir) then
local files = app.fs.listFiles(dir)
for _,filename in ipairs(files) do
-- Check if the file is an image by its extension
local extension = string.sub(filename, -4)
if extension == ".png" or extension == ".jpg" or extension == ".bmp" or extension == ".gif" then
-- Extract the full path to the file
local filePath = app.fs.joinPath(dir, filename)
-- Check if there is an active sprite
local sprite = app.activeSprite
if not sprite then
return app.alert("There is no active sprite.")
end
-- Creates a new layer with the file name
local newLayer = sprite:newLayer()
newLayer.name = filename
-- Load the image
local image = Image{ fromFile=filePath }
-- If the image could be loaded, add it to the sprite
if image then
-- Get the current frame
local currentFrame = app.activeFrame
-- Adds the image to the layer at the current frame
sprite:newCel(newLayer, currentFrame, image)
else
app.alert("Could not load image: " .. filename)
end
-- Refreshes the sprite view
app.refresh()
end
end
else
print("Error. Select an image in the folder you have all the images.")
end