Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Desour opened this issue Aug 13, 2024 · 4 comments
Open

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

Desour opened this issue Aug 13, 2024 · 4 comments

Comments

@Desour
Copy link
Member

Desour commented Aug 13, 2024

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

@SmallJoker
Copy link
Member

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

imghdr is deprecated. Maybe filetype is a viable alternative.

@rubenwardy
Copy link
Member

rubenwardy commented Aug 13, 2024

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

@sfan5
Copy link
Member

sfan5 commented Aug 16, 2024

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

@Wuzzy2
Copy link
Contributor

Wuzzy2 commented Nov 4, 2024

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.".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants