Page 1 of 1

Resize image

Posted: Mon Jul 10, 2017 12:18 pm
by egorcod
Hello!

I was created image by love.graphics.newImage. Can I resize it?

Re: Resize image

Posted: Mon Jul 10, 2017 12:55 pm
by erasio
The image itself does not contain size, position, shearing and such.

You provide this information when drawing with love.graphics.draw.

Take a look at that documentation page and reply if there's still a question :)

Re: Resize image

Posted: Mon Jul 10, 2017 6:52 pm
by MasterLee
No you can't resize image. You can scale the image during drawing as mentioned above, but the size of the image itself can not be changed.

Re: Resize image

Posted: Mon Jul 10, 2017 7:53 pm
by Sir_Silver
@erasio, the image returned from love.graphics.newImage actually does contain, at least, the size (dimensions) of the image.

https://love2d.org/wiki/Image

Re: Resize image

Posted: Mon Jul 10, 2017 9:16 pm
by Lafolie
MasterLee wrote: Mon Jul 10, 2017 6:52 pm No you can't resize image. You can scale the image during drawing as mentioned above, but the size of the image itself can not be changed.
Ah, but what if you display a scaled image and dump the result to a file, then reload it? ;)

Then scale it back up to the original resolution for the pixelly goodness (or badness if you use filtering).

Re: Resize image

Posted: Mon Jul 10, 2017 10:19 pm
by MasterLee
Lafolie wrote: Mon Jul 10, 2017 9:16 pm
MasterLee wrote: Mon Jul 10, 2017 6:52 pm No you can't resize image. You can scale the image during drawing as mentioned above, but the size of the image itself can not be changed.
Ah, but what if you display a scaled image and dump the result to a file, then reload it? ;)

Then scale it back up to the original resolution for the pixelly goodness (or badness if you use filtering).
That is not resizing in image. That is creating new Image.
Btw. Python PIL is cheating also it does:

Code: Select all

img = img.resize((new_width, new_height), Image.ANTIALIAS)
And that is creating new image. And face it most libs can't resize image.
All they do is creating new image and than transfering old data.

Re: Resize image

Posted: Tue Jul 11, 2017 6:23 am
by egorcod
Thanks!