how to find the width and height of an 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
onedaysnotice
Citizen
Posts: 63
Joined: Sun May 13, 2012 2:49 am

how to find the width and height of an image?

Post by onedaysnotice »

i don't want to use fixed values :S

i was thinking love.graphics.getWidth(img) but that didn't work :(
User avatar
rokit boy
Party member
Posts: 198
Joined: Wed Jan 18, 2012 7:40 pm

Re: how to find the width and height of an image?

Post by rokit boy »

Say you made your Image:

Code: Select all

img = love.graphics.newImage("PATH/TO/IMAGE")
then if you want to set width to the Width you do:

Code: Select all

width = img:getWidth( )
Now width should be the width of image (in pixels)

EDIT: You don't need to thank for the speedy reply, everyone here replies really fast (!)
u wot m8
onedaysnotice
Citizen
Posts: 63
Joined: Sun May 13, 2012 2:49 am

Re: how to find the width and height of an image?

Post by onedaysnotice »

rokit boy wrote:EDIT: You don't need to thank for the speedy reply, everyone here replies really fast (!)
thanks anyways! :D
User avatar
rokit boy
Party member
Posts: 198
Joined: Wed Jan 18, 2012 7:40 pm

Re: how to find the width and height of an image?

Post by rokit boy »

onedaysnotice wrote:
rokit boy wrote:EDIT: You don't need to thank for the speedy reply, everyone here replies really fast (!)
thanks anyways! :D
Always happy to help.
u wot m8
Post Reply

Who is online

Users browsing this forum: No registered users and 54 guests