contentdb icon indicating copy to clipboard operation
contentdb copied to clipboard

Can't upload screenshot, "isn't actually an image"

Open Desour opened this issue 1 year ago • 4 comments

Summary

I'm trying to upload screenshots as jpg, by converting them from png with ffmeg. But contentdb fails to recognize them as image.

Steps to reproduce
  • Take some png image. (For example: default_lava.png from devtest)
  • Convert it to jpg with ffmpeg: ffmpeg -i input_file output_file
  • Try uploading it as a screenshot on contentdb.
  • It fails with the message: Uploaded image isn't actually an image

Here's an example, it's clearly a jpeg image, just ask file: default_lava

And it is, in fact, an image. Stop gaslighting me!

Relevant code, probably

https://github.com/minetest/contentdb/blob/master/app/logic/uploads.py

Desour avatar Aug 13 '24 16:08 Desour

https://docs.python.org/3/library/imghdr.html

imghdr is deprecated. Maybe filetype is a viable alternative.

SmallJoker avatar Aug 13 '24 16:08 SmallJoker

If I open it in GIMP and re-export it again, it works. So something is odd with the encoding that imghdr can't recognise

rubenwardy avatar Aug 13 '24 16:08 rubenwardy

CDB already depends on Pillow, I'm sure it can determine the image type.

sfan5 avatar Aug 16 '24 14:08 sfan5

At the very least, the error message should be fixed. Something like: "This is either not an image or this image format is not supported by ContentDB.".

Wuzzy2 avatar Nov 04 '24 12:11 Wuzzy2