When I make a sprite, I usually like exporting it in 100%, 200% 300% and 400% size for ease of use and visibility. I made a simple script for that.
for i = 1,4,1 do
local fn = path .. '/' .. title .. '-' .. i .. 'x'
app.command.SaveFileCopyAs{
useUI=false,
scale=i;
filename=fn .. '.png'
}
end
… But the “scale” parameter seems to do nothing at all, no matter what I set the value at. I’ve checked this out, so I know there is a parameter called scale and its default value is 1.0, but setting it to, for example, 2.0, seems to do nothing.
local activeSprite = app.activeSprite
if not activeSprite then return end
local activeFrame = app.activeFrame
or activeSprite.frames[1]
local palette = activeSprite.palettes[1]
local blit = Image(activeSprite.spec)
blit:drawSprite(activeSprite, activeFrame)
local path = "mypath\\"
local title = "blah"
local format = ".png"
for i = 1, 4, 1 do
local scaled = blit:clone()
scaled:resize {
width = scaled.width * i,
height = scaled.height * i
}
scaled:saveAs {
filename = path .. title .. i .. format,
palette = palette
}
end
I try to avoid commands whenever possible for reasons like this.
(Obviously there’s inefficiency in the script above, since there’s no need clone and scale an image by 1x, but you get the point.)
This does work, and I’m very grateful for your answer! But I’m still a bit irked as to why the scale parameter doesn’t work… I should change the thread title.
Once again, thanks for the help, the script works wonders.
If you’d like to pursue the bug further, what version of Aseprite are you using? I tried app.command.SaveFileCopyAs in 1.3-beta20 and the results were scaled properly. In 1.2.35 they weren’t. There might be a clue in the commit history for the source code you linked above.