Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 1 commit into from
Aug 5, 2017

Conversation

larsoner
Copy link
Contributor

@larsoner larsoner commented Aug 3, 2017

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:

I might say start clustering it with other options for the thumbnail, like the default image... Of course that would break backwards compatibility.

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.

@larsoner larsoner changed the title WIP: Add thumbnail_size option MRG: Add thumbnail_size option Aug 4, 2017
@larsoner
Copy link
Contributor Author

larsoner commented Aug 4, 2017

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.

Copy link
Contributor

@choldgraf choldgraf left a 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')"
Copy link
Contributor

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 = {
...
Copy link
Contributor

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
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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)

@larsoner
Copy link
Contributor Author

larsoner commented Aug 5, 2017

Yes I tested these code suggestions on restoring the PySurfer examples back to 250x250px

@larsoner
Copy link
Contributor Author

larsoner commented Aug 5, 2017

@choldgraf
Copy link
Contributor

ewww @Eric89GXL you're using matplotlib < 2.0?!?! That jet is killing me :-)

LGTM

@choldgraf choldgraf merged commit b6e1b5e into sphinx-gallery:master Aug 5, 2017
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