[Script] Copy Merged Scaled

Oftentimes I find myself needing to copy a merged version of the sprite layers, and also to scale it up so that I can paste it wherever to show it to people.

The usual method to this that I’ve found is doing “Copy Merged”, making a new sprite, pasting it there, resizing it, selecting the entire thing, copying it, and discarding the sprite.

This script simplifies that into a single dialog prompt. You can also bind it to a keyboard shortcut (e.g. Ctrl+Alt+C) via Edit > Keyboard Shortcuts.
png2

local d = Dialog("Copy Merged Scaled")
d:number{ id="scale", label="Scale", text="2", focus=true }
 :button{ id="ok", text="&OK", focus=true }
 :button{ text="&Cancel" }
 :show()

local data = d.data
if not data.ok then return end
local scale = data.scale

app.command.CopyMerged()
app.command.NewFile({ ui = false, fromClipboard = true })
local sprCopy = app.activeSprite
app.command.SpriteSize({ ui = false, scale = scale, method = "nearest" })
sprCopy.selection:selectAll()
app.command.CopyMerged()
sprCopy:close()

app.refresh()
10 Likes