-
Notifications
You must be signed in to change notification settings - Fork 8
add thumbnail_size property #34
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
Conversation
I'm not sure if Pillow allows this. Pillow seems to consider the given size as a hint. Which is why we have Another nice addition would be to select a better default size when the data is very anisotropic. I noticed too that with the xray app the low-res data is way too low-res :P BTW: I suspect that we're using different versions of Black (CI runs the latest). |
Ready for review. I tested this on the xray app of the gallery. Probably I should add more tests and an example :-). |
dash_slicer/slicer.py
Outdated
thumbnail_size (int or None): linear size of low-resolution data to be | ||
uploaded to the client. If ``None``, the full-resolution data are | ||
uploaded client-side. |
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.
Feeling a bit uncomfortable about the None
which is often used to denote a default value. What about just thumbnail
, which can be set to True
/False
, but also allowing an int with the size? Once we've fixed the anisotropy thing, the default size should be fine in nearly all cases.
Let's also mention the default size here.
dash_slicer/slicer.py
Outdated
@property | ||
def thumbnail_size(self): |
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.
Not sure if we need a public prop for this. Or do you have a use-case in mind?
dash_slicer/slicer.py
Outdated
if self._thumbnail_size is None: | ||
thumbnail_size = None | ||
info["lowres_size"] = info["size"] | ||
else: |
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.
Maybe a check here to make thumbnail_size
None when the given size is larger than the image size?
This is nice! |
Thanks for the review @almarklein ! |
This PR looks good to go. Do you know what's up with the circleci build, @emmanuelle ? |
[Updated]
This PR introduces a
thumbnail_size
property of the slicer, in order to be able to choose the size of the low-resolution images uploaded and available clientside. It is an integer, or None, in which case the full resolution data is uploaded clientside (I implemented this by not attaching the server callback, which was an easy solution).