Can't load any file as imageData

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
deiwyy
Prole
Posts: 1
Joined: Sun Nov 29, 2020 5:51 pm

Can't load any file as imageData

Post 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)
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: Can't load any file as imageData

Post 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?
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
User avatar
pgimeno
Party member
Posts: 3548
Joined: Sun Oct 18, 2015 2:58 pm

Re: Can't load any file as imageData

Post 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.
Albur Godwin
Prole
Posts: 1
Joined: Sat Sep 25, 2021 9:08 am

Re: Can't load any file as imageData

Post 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.
Last edited by Albur Godwin on Thu Dec 23, 2021 5:14 pm, edited 1 time in total.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 65 guests