Resize image

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
egorcod
Prole
Posts: 17
Joined: Sun Jul 02, 2017 9:41 am

Resize image

Post by egorcod »

Hello!

I was created image by love.graphics.newImage. Can I resize it?
User avatar
erasio
Party member
Posts: 118
Joined: Wed Mar 15, 2017 8:52 am
Location: Germany

Re: Resize image

Post 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 :)
MasterLee
Party member
Posts: 141
Joined: Tue Mar 07, 2017 4:03 pm
Contact:

Re: Resize image

Post 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.
User avatar
Sir_Silver
Party member
Posts: 286
Joined: Mon Aug 22, 2016 2:25 pm
Contact:

Re: Resize image

Post 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
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Resize image

Post 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).
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

Post 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.
egorcod
Prole
Posts: 17
Joined: Sun Jul 02, 2017 9:41 am

Re: Resize image

Post by egorcod »

Thanks!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 3 guests