Created
November 25, 2019 13:26
-
-
Save dacap/764c5b026b1293282299a9246c451c89 to your computer and use it in GitHub Desktop.
Export the active sprite to a png file scaling it to 2000%
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local orig = app.activeSprite | |
if not orig then print("There is no active sprite to resize") end | |
local function replace_extension(path, newext) | |
local file, ext = string.match(path, "(.-)([^.]*)$") | |
if file and ext and file ~= "" and ext ~= "" then | |
return file .. newext | |
else | |
return path .. '.' .. newext | |
end | |
end | |
local spr = Sprite(orig) -- Duplicate sprite | |
spr:resize{ width=20*orig.width, height=20*orig.height } | |
spr:saveAs(replace_extension(orig.filename, 'png')) | |
spr:close() | |
app.activeSprite = orig |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment