getScreenShot produces stretched images


(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.
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?


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?


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