## Resize image

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
egorcod
Prole
Posts: 16
Joined: Sun Jul 02, 2017 9:41 am

### Resize image

Hello!

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

erasio
Party member
Posts: 118
Joined: Wed Mar 15, 2017 8:52 am
Location: Germany

### Re: Resize image

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

MasterLee
Party member
Posts: 141
Joined: Tue Mar 07, 2017 4:03 pm
Contact:

### Re: Resize image

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.

Sir_Silver
Party member
Posts: 286
Joined: Mon Aug 22, 2016 2:25 pm

### Re: Resize image

@erasio, the image returned from love.graphics.newImage actually does contain, at least, the size (dimensions) of the image.

https://love2d.org/wiki/Image

Lafolie
Inner party member
Posts: 803
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

### Re: Resize image

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).
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.

MasterLee
Party member
Posts: 141
Joined: Tue Mar 07, 2017 4:03 pm
Contact:

### Re: Resize image

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.

egorcod
Prole
Posts: 16
Joined: Sun Jul 02, 2017 9:41 am

Thanks!

### Who is online

Users browsing this forum: No registered users and 7 guests