Page MenuHomePhabricator

OpenSeaDragon crops images at certain zoom levels
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

  • part of the image is missing on the right and at the bottom at moderate zoom levels, but it appears completely if you zoom enough
  • if you edit the Index properties (https://fr.wikisource.org/wiki/Livre:9_02_1885_Martinet.djvu) and set "Résolution de l’image (zoom)" (Scan resolution in edit mode) to 2479, this problem disappears.

What should have happened instead?:
OpenSeaDragon should not crop the image, whatever value is entered in the "Scan resolution in edit mode" parameter.

Other information (browser name/version, screenshots, etc.):
I don't know if the same behaviour appears in other Wikisources. It has been reported in several books on the French Wikisource, but not on every page of these books.
For example, https://fr.wikisource.org/wiki/Page:Istrati_-_Nerrantsoula,_1927.djvu/125 and https://fr.wikisource.org/wiki/Page:Larousse_-_Grand_dictionnaire_universel_du_XIXe_si%C3%A8cle_-_Tome_1,_part._2,_An-Ar.djvu/387 exhibited the problem before the "Scan resolution in edit mode" parameter was modified.

In case it helps, I noticed that the srcset= attribute is added in the hidden IMG tag inside the page when the cropping problem appears:

<div class="prp-page-image"><span><img src="//upload.wikimedia.org/wikipedia/commons/thumb/5/58/9_02_1885_Martinet.djvu/page1-1280px-9_02_1885_Martinet.djvu.jpg" decoding="async" width="1280" height="1811" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/5/58/9_02_1885_Martinet.djvu/page1-1920px-9_02_1885_Martinet.djvu.jpg 2x" data-file-width="2479" data-file-height="3508"></span></div>

Event Timeline

Change #1264906 had a related patch set uploaded (by Bhsd; author: Bhsd):

[mediawiki/extensions/ProofreadPage@master] OpenseadragonController: correct image dimensions

https://gerrit.wikimedia.org/r/1264906

I believe that this patch solved the problem. Thank you!

Change #1264906 merged by jenkins-bot:

[mediawiki/extensions/ProofreadPage@master] OpenseadragonController: correct image dimensions

https://gerrit.wikimedia.org/r/1264906

Bhsd moved this task from Backlog to Done: to deploy/check on the ProofreadPage board.
Bhsd subscribed.

The patch will be deployed next week, but you can test it now on the beta cluster (e.g., https://en.wikisource.beta.wmcloud.org/wiki/Page:9_02_1885_Martinet.djvu/1?action=edit).

I wonder if we should revisit the system of loading a higher-res image for zooming. It seems that currently the whole OpenSeadragon pyramid (of two files) is loaded on page load, which to my mind negates the purpose of switching to the higher-res image. If we're going to load it up front anyway, then it seems like we should just not use the lower-res one. For example, for the above Page, these two are always loaded:

However, rather than always loading the higher-res image from the srcset, should we perhaps just go back to only using the src image? Because for many scans that's sufficiently legible, and for those where it's not there is the Index page's Width field that editors can set when they need a higher resolution.

Or does that make things worse for high-density displays?

Mac seems to always load the 2x version instead of the src image, so switching to the src image may cause a lower image quality for Mac users.

Ah yes right that makes sense doesn't it: 2x displays are only loading that one. It's the lower-density ones that are loading both. And I guess we can't detect which is which?

And I guess we can't detect which is which?

I find a devicePixelRatio property which may help.

Change #1269002 had a related patch set uploaded (by Bhsd; author: Bhsd):

[mediawiki/extensions/ProofreadPage@master] OpenseadragonController: always use the highest resolution

https://gerrit.wikimedia.org/r/1269002

Change #1269002 merged by jenkins-bot:

[mediawiki/extensions/ProofreadPage@master] OpenseadragonController: pick a single resolution

https://gerrit.wikimedia.org/r/1269002

Change #1269071 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/ProofreadPage@master] Use simple image source rather than legacy-image-pyramid

https://gerrit.wikimedia.org/r/1269071

Change #1269071 merged by jenkins-bot:

[mediawiki/extensions/ProofreadPage@master] Use simple image source rather than legacy-image-pyramid

https://gerrit.wikimedia.org/r/1269071

Change #1275146 had a related patch set uploaded (by Bhsd; author: Bhsd):

[mediawiki/extensions/ProofreadPage@master] Use simple image source for edit-in-sequence

https://gerrit.wikimedia.org/r/1275146

Change #1275146 merged by jenkins-bot:

[mediawiki/extensions/ProofreadPage@master] Use simple image source for edit-in-sequence

https://gerrit.wikimedia.org/r/1275146