-
Notifications
You must be signed in to change notification settings - Fork 182
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
fix: upload failure due to non-rgb image #335
Conversation
# Auto resize to max 512x512 | ||
image = Image.open(blob) | ||
image = image.convert("RGB") | ||
if image.height > 512 or image.width > 512: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The resizing logic should maintain the aspect ratio. Consider using image.thumbnail((512, 512), Image.ANTIALIAS)
to resize while maintaining the aspect ratio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, note on pathlib.
nomic/dataset.py
Outdated
@@ -1420,6 +1421,7 @@ def _add_blobs( | |||
elif isinstance(blob, bytes): | |||
images.append((uuid, blob)) | |||
elif isinstance(blob, Image.Image): | |||
image = image.convert("RGB") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conversion of images to RGB format is repeated in the _add_blobs
function. Consider refactoring to avoid this repetition.
Summary:
Fixes image upload failures by converting non-RGB images to RGB format in
nomic/dataset.py
.Key points:
nomic/dataset.py
._add_blobs
function.Generated with ❤️ by ellipsis.dev