Repository navigation
Conversation
|
Ideally, this should be accompanied by measures to reduce the amount of transferred data again, e.g. one or more of:
|
|
Here is what this looks like: https://55954-1385122-gh.circle-artifacts.com/0/doc/build/html/index.html |
|
Despite what I said above, the thumbnails are the same size regardless of the dpi of the parent. I don't think that the individual images on the individual pages are so giant that its worth serving different sizes. |
|
All my suggestions are primarily intended for the thumbnails. I agree that individual gallery images aren't that important because you only load a few. |
|
I think this looks better... I looked into svg. a) in quite a few places we have links to pngs. b) animations don't work, c) at east on my version of sphinx |
|
In the above, the RHS screenshot looks better on my retina display? Is that a pixel grab from your machine? I'm confused how a 72-dpi image could render better than a 200-dpi image. In general I am confused by what you are trying to say (but I don't have a 100dpi monitor, so..) The scaling is not a factor of two because it is 72 dpi versus 200 dpi, and then a 70% scaling of the image. So 1280 is 6.4 inches at 200 dpi. That 6.4 inches was 461 pixels at 72 dpi. |
|
Agreed, I think maybe somehow my local machine was defaulting to 72 dpi.... But I'm not sure what to say about the scaling of 200 dpi images. We don't specify |
|
I really don't understand the scaling. This makes https://56240-1385122-gh.circle-artifacts.com/0/doc/build/html/gallery/lines_bars_and_markers/bar_label_demo.html#sphx-glr-gallery-lines-bars-and-markers-bar-label-demo-py The image is 1280x960 as expected, but it gets scaled to 460x345, which is (1280x960)/2*0.72 I don't understand where the 0.72 comes from... |
|
The only way to treat this image as 2x dpi, is to specify it in |
|
Ugh, implementing |
|
There's a principle willingness at sphinx-gallery to make a custom image directive. That could be combined with the lazy-loading effort (see sphinx-gallery/sphinx-gallery#803 (comment)). So ideally, this goes upstream and sphinx-gallery provides a more capable figure/image (not sure which one should be adapted) directive. Seems like docutils itself is not very respnsive. At least there hasn't been any reaction to my lazy loading feature request https://sourceforge.net/p/docutils/feature-requests/78/. |
|
I hacked a proof of concept together. It's not too bad so far. But if we adopt something like it, it would be nice if someone upstream took it on. OTOH I'm not sure anyone will be happy about the extra render time to make two copies of each image in the gallery. |
One could introduce an option for this and only enable it for releases (or disable on CI). |
|
@timhoffm I invited you to https://github.com/jklymak/sphinx-image-srcset. It works for the simple gallery that I have put in there. Still pretty messy, and not deployable, but maybe you had feedback... |
Is it not just a second |
|
It is just a second savefig with the dpi call changed. |
|
Closing in favour of fixing this in sphinx-gallery...sphinx-gallery/sphinx-gallery#808 |




PR Summary
Right now all our gallery images are 100 dpi; I know this won't speed up loading the thumbnails, but, 100 dpi looks pretty bad on a 200 dpi screen. Note there is a css change to account for the larger native size. I don't understand where 70% comes from...
PR Checklist
pytestpasses).flake8on changed files to check).flake8-docstringsand runflake8 --docstring-convention=all).doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).