-
Notifications
You must be signed in to change notification settings - Fork 207
MRG: Add thumbnail_size option #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
Conversation
b90d556
to
a6176fa
Compare
a6176fa
to
937821a
Compare
I have now tested this and it works well to get PySurfer's images scaled nicely. It also makes the scaling slightly nicer for the BROKEN and default images by unifying the scaling routines instead of using different sizes. (This will have some presumably small negative impact on page load times.) CIs are happy. Ready for review/merge from my end. |
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.
assuming that this actually does what it says it does (do you have a link to a before/after?) I think this is pretty much good to go. Some small things.
@@ -198,3 +198,6 @@ pseudoxml: | |||
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml | |||
@echo | |||
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." | |||
|
|||
show: | |||
@python -c "import webbrowser; webbrowser.open_new_tab('file://$(PWD)/$(BUILDDIR)/html/index.html')" |
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.
I'm +1 for this...my fingers will appreciate it in the long run
@@ -85,6 +88,7 @@ want to build only one example so that you can link it in the documentation. In | |||
you would do:: | |||
|
|||
sphinx_gallery_conf = { | |||
... |
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.
good idea for these ellipses
} | ||
|
||
The gallery uses various CSS classes to display these thumbnails, which | ||
default to maximum 160x160px. To change this, e.g. to display the images |
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.
why do you type the sizes in regular font here, but use code font above?
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.
Python vs CSS (approximately)
# at all (maybe could be an option someday...) | ||
img = img.resize((width_sc, height_sc), Image.BICUBIC) | ||
# img.thumbnail((width_sc, height_sc), Image.BICUBIC) | ||
# width_sc, height_sc = img.size # necessary if using thumbnail |
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.
what are these commented-out lines for? future dev?
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.
Using the thumbnail (non-upsampling) method if we ever want it (as suggested by the preceding comments)
Yes I tested these code suggestions on restoring the PySurfer examples back to 250x250px |
Before/after would be: https://sphinx-gallery.readthedocs.io/en/latest/auto_examples/index.html Though it's not terribly interesting because SG uses the defaults. |
ewww @Eric89GXL you're using matplotlib < 2.0?!?! That jet is killing me :-) LGTM |
Closes #282.
WIP because #279 needs to be merged first, then I can properly document how to get different thumbnail sizes.
In #277 @Titan-C you suggested this:
Here I've decided to avoid the step of combining keys. It seems like it could create a bit of deprecation pain for little gain in terms of readability.
I also added the "show"
Makefile
option because I've found it helpful previously, but I can split that off or remove it if need be.