invalid CRC encountered

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Lesommeil
Prole
Posts: 4
Joined: Tue Apr 19, 2022 11:09 am

invalid CRC encountered

Post by Lesommeil »

Code: Select all

function love.load()
    instance = {}
    instance.img = love.graphics.newImage("coin.png")
end

function love.draw()

    love.graphics.draw(instance.img, 100, 100)
    
end
But if the png size is too small like 17*17, this happens.


Error

main.lua:3: Could not decode PNG image (invalid CRC encountered (checking CRC can be disabled))


Traceback

[love "callbacks.lua"]:228: in function 'handler'
[C]: in function 'newImage'
main.lua:3: in function 'load'
[love "callbacks.lua"]:136: in function <[love "callbacks.lua"]:135>
[C]: in function 'xpcall'
[C]: in function 'xpcall'


I don't even know what CRC is, so there is really no way I can solve this.
---------------------------------------------------------------------------------
I guess not all computers have this issue, so I uploaded a youtube video.
https://www.youtube.com/watch?v=ykeVRNuXbWo
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: invalid CRC encountered

Post by ReFreezed »

CRC is a checksum, in this case stored in the PNG, that should tell whether the PNG data is correct or corrupt. Most likely in your case it's not the data that's corrupt, but the checksum itself. I don't think there's a way to disable the CRC check without editing the relevant C++ code in LÖVE and recompiling everything, so all you can do is re-save the image in your image editing program so it gets the correct CRC. If the program is calculating the CRC incorrectly when saving I guess you'll have to use another program to save the file.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
Lesommeil
Prole
Posts: 4
Joined: Tue Apr 19, 2022 11:09 am

Re: invalid CRC encountered

Post by Lesommeil »

ReFreezed wrote: Thu Apr 28, 2022 12:42 pm CRC is a checksum, in this case stored in the PNG, that should tell whether the PNG data is correct or corrupt. Most likely in your case it's not the data that's corrupt, but the checksum itself. I don't think there's a way to disable the CRC check without editing the relevant C++ code in LÖVE and recompiling everything, so all you can do is re-save the image in your image editing program so it gets the correct CRC. If the program is calculating the CRC incorrectly when saving I guess you'll have to use another program to save the file.
I will do it, thank you help me make sense of what CRC is!
Post Reply

Who is online

Users browsing this forum: slime and 6 guests