Page 1 of 1
Can't load any file as imageData
Posted: Sun Nov 29, 2020 6:20 pm
by deiwyy
I get an error whenever i try to do
Code: Select all
love.graphics.newImage("icon.png")
or
Code: Select all
love.image.newImageData("icon.png")
I've tried using png, jpg and ico file formats, all of them gave me this error
Error
boot.lua:557: Could not decode file 'icon.jpg' to ImageData: unsupported file format
Traceback
[C]: in function 'newImageData'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
All of the images were valid (I had no problem opening them in galery)
Re: Can't load any file as imageData
Posted: Sun Nov 29, 2020 9:47 pm
by ReFreezed
I don't think JPEG files are supported any longer. ICO files were never supported, afaik. PNG files should work though. Not sure what the problem is. Can you upload one of the PNG files that don't work?
Re: Can't load any file as imageData
Posted: Sun Nov 29, 2020 11:54 pm
by pgimeno
JPEG writing isn't supported, but JPEG reading is. love.graphics.newImage('image.jpg') is working fine for me as well as love.image.newImageData('image.jpg').
+1 about showing a problematic file. Unfortunately, I think that during the first few posts, people can't attach stuff.
Re: Can't load any file as imageData
Posted: Thu Dec 23, 2021 5:07 pm
by Albur Godwin
(I know this is a year-old thread, but I stumbled upon it today while looking for an answer, so this may be of interest to others.)
It might be that your file is in fact in HEIC format. This just happened to me today, and when I opened it with some software in hope of fixing it by resaving it, I eventually realized it was considered so, since .heic was appended in the preview (I noticed Paint showed it, while Paint 3D did not).
Resaving the file explicitly as a PNG (using a piece of software that keeps hold of transparency) did the trick for me.