Can you resize a image/cel programatically? (lua scripting)

I’ve been able to read the size (x and y) of an image by doing:

local image = app.activeCel.image
print("width="..image.width.." height="..image.height)

but it seems that I cannot use resize on image or cel. It only works on the sprite, but what it resizes is the canvas.

local image = app.activeCel.image
image:resize(image.width, image.height*2) ---> field does not exists
local spr = app.activeSprite
spr:resize(spr.width, spr.height*2) ---> it resizes canvas only

I’ve searched for info about this in the api, and also tried semi-random things like Scale() (which is not a real method, I tried it just in case it existed but was not documented XD), but not luck at all

Is there any solution fo rthis? Thanks in advance! :slight_smile:

Hi @JJHaggar, actually some things about this:

  1. Sprite:resize() has a bug where only the canvas size is changed I think the whole sprite should be resized.
  2. There is no Image:resize() but it would be nice to have it.
  3. Next version (v1.2.14) will have more options for app.command.SpriteSize() command available, but I think that in v1.2.13 can already use something like this:
    app.command.SpriteSize{ ["use-ui"]=false, width=..., height=... }
    
2 Likes

Thanks @dacap, that worked perfectly in v1.2.13! :+1:

I look forward to next Aseprite version, and also Image:resize()! :smiley:

1 Like