Skip to content

Enable upload for all our supported image formats #283

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

Closed
wants to merge 1 commit into from

Conversation

stellasphere
Copy link
Contributor

@stellasphere stellasphere commented Jul 11, 2024

Description

We support many other formats other than the ones we currently allow. We also lost jpg (not jpeg) support in PR #51 (https://github.com/roboflow/roboflow-python/pull/51/files#diff-05ecffcd056f67631588da1975ca43403a88910478c8435876abcdd85b7a8025)

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this change been tested, please provide a testcase or example of how you tested the change?

Tested locally and in this colab: https://colab.research.google.com/drive/1oRqgsKEiihpVpxz5sAWXfTq5L4Eq_zdY?usp=sharing

@stellasphere stellasphere marked this pull request as ready for review July 11, 2024 00:23
@stellasphere stellasphere self-assigned this Jul 11, 2024
@stellasphere stellasphere requested a review from iurisilvio July 11, 2024 00:23
iurisilvio
iurisilvio previously approved these changes Jul 11, 2024
Copy link
Contributor

@iurisilvio iurisilvio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's fix it, but later we have to change to look for minetypes, not only file extensions.

@iurisilvio iurisilvio dismissed their stale review July 11, 2024 06:54

We use PIL format, it is normalized to JPEG. We have to understand this problem better.

@iurisilvio
Copy link
Contributor

I think the issue is with invalid images, I see a lot of it in other projects.

We need a verbose mode explaining why it failed.

@iurisilvio
Copy link
Contributor

I tested here:

>>> from PIL import Image
>>> image = Image.open("image.jpg")
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=4080x3072>
>>> image.format
"JPEG"

The issue is probably with invalid images. We can use filetype lib to get the real type and give a good warning when file extension doesn't match expected mime extension:

>>> import filetype
>>> kind = filetype.guess("original.jpg")
>>> kind.extension
'avif'
>>> kind.mime
'image/avif'

@iurisilvio
Copy link
Contributor

Closing this one because I merged #284 with a more complete solution.

@iurisilvio iurisilvio closed this Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants