I want to create an image and edit it's size (I don't want to use scale factor, I want to set it to a certain size in pixels)
Is this possible?
Is it possible to set the size of an image?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 9
- Joined: Sat Sep 13, 2014 10:20 pm
Re: Is it possible to set the size of an image?
I think it impossible to change the size of an image within LÖVE. But using scale will do like you want to:
Example, if your image dimensions is 64 x 64 pixels then you want to resize it to 32 x 32 pixels:
setImageSize function returns 0.5 for both scale X and Y.
Code: Select all
function setImageSize(image, x, y)
return x / image:getWidth(), y / image:getHeight()
end
Code: Select all
local image = love.graphics.newImage("image.png")
love.graphics.draw(image, 0, 0, 0, setImageSize(image, 32, 32))
-
- Prole
- Posts: 9
- Joined: Sat Sep 13, 2014 10:20 pm
Re: Is it possible to set the size of an image?
Ah, it worked.
Thank you very much!
Thank you very much!
Who is online
Users browsing this forum: Ahrefs [Bot] and 3 guests