Creates a new Image from a filepath, FileData, an ImageData, or a CompressedImageData, and optionally generates or specifies mipmaps for the image.
Version 11.0 updated love.graphics.newImage to treat file names ending with "@2x", "@3x", etc. as a pixel density scale factor if none is explicitly supplied.
This function can be slow if it is called repeatedly, such as from love.update or love.draw. If you need to use a specific resource often, create it once and store it somewhere it can be reused!
image = love.graphics.newImage( filename )
string filenameImage imageimage = love.graphics.newImage( imageData )
ImageData imageDataImage image Available since LÖVE 0.9.0
This variant is not supported in earlier versions.
image = love.graphics.newImage( compressedImageData )
CompressedImageData compressedImageDataImage image Available since LÖVE 0.10.0
This variant is not supported in earlier versions.
image = love.graphics.newImage( filename, flags )
string filenametable flagsboolean linear (false)boolean or table mipmaps (false)Image image Available since LÖVE 0.9.1 and removed in LÖVE 0.10.0
This variant is not supported in earlier or later versions.
image = love.graphics.newImage( filename, format )
string filenameTextureFormat formatImage imagefunction love.load()
bunny = love.graphics.newImage("MyBunny.png")
end
function love.draw()
love.graphics.draw(bunny, 0, 0)
end
© 2006–2020 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.graphics.newImage