Page 1 of 1
invalid CRC encountered
Posted: Thu Apr 28, 2022 10:37 am
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
Re: invalid CRC encountered
Posted: Thu Apr 28, 2022 12:42 pm
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.
Re: invalid CRC encountered
Posted: Thu Apr 28, 2022 2:01 pm
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!