Skip to content

Improve loading speed for image cards #279

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

Merged
merged 6 commits into from
Nov 5, 2019
Merged

Conversation

taalbrecht
Copy link
Contributor

Current loading speeds of the dataset page can be quite slow when using high resolution images. This greatly improves loading speed for image cards on dataset page by resizing and compressing thumbnail images to a maximum allowable image size. It also uses this smaller thumbnail image for both annotated and non-annotated images.


# Calculate resize ratio:
resize_ratio = min(1, self.MAX_THUMBNAIL_DIM[0] / pil_image.height,
self.MAX_THUMBNAIL_DIM[1] / pil_image.width)
Copy link
Owner

@jsbroks jsbroks Nov 2, 2019

Choose a reason for hiding this comment

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

I think we can simplify this by using PIL.Image.thumbnail

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, you're right. I can make the changes on Monday and update the pull request.

@jsbroks jsbroks merged commit 8f80957 into jsbroks:master Nov 5, 2019
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