getScreenShot produces stretched images

viewer-api

(Robankonna) #1

I've noticed a minor but persistent bug in the getScreenShot method of the Sketchfab API. Sometimes the images produced are stretched vertically or horizonally.

Here's a couple ways to reproduce it. Any viewer with any model will do; here's the Labs experiment with a low-poly model.
https://labs.sketchfab.com/experiments/screenshots/#model/3fb1d948d15241da9dd08253fbe43e21
I've tested the following on Chrome and Firefox:

  • Scale or zoom the browser window so that the viewer is not visible at all and click "Export screenshot"
  • Change the width of the viewer iframe (to any width other than the default) via the browser's developer tools and click "Export screenshot"

The viewer iframe scales to the desired image size during the screenshotting, so the image produced has correct dimensions, but it seems to be a scaled version of an image with a different aspect ratio.

I haven't pinpointed the cause, so I'd like to know if anyone else has encountered the bug and successfully prevented it from happening. I have attempted to patch this several times during the past months, but it seems that end users have infinite different ways to produce the error. Is it possible to detect the problem at the level of the HTMLIFrameElement API used by getScreenShot?


#2

Hmm, @mauricesvay any idea?


(Mauricesvay) #3

I'm not sure to understand the problem. Can you share an example of a screenshot that doesn't work?


#4

produced this by zooming out until the viewer disappears, then exporting the image. it's kind of a weird situation ¯\_(ツ)_/¯