PDF.js displays blurry plots in PDF documents, e.g.

http://arxiv.org/pdf/1202.5344v1.pdf

When viewed in Chrome or Adobe Acrobat all the plots show sharp-edged squares. When viewed in Preview or PDF.js, all the squares show as blurry pixelated blobs.

if (!this.contentVisible) {
        return;
      }
      const width = imgData.width;
      const height = imgData.height;
      const ctx = this.ctx;
      this.save();
      
      ctx.scale(1 / width, -1 / height);
      const currentTransform = ctx.mozCurrentTransformInverse;
      let widthScale = Math.max(
        Math.hypot(currentTransform[0], currentTransform[1]),
        1
      );
      let heightScale = Math.max(
        Math.hypot(currentTransform[2], currentTransform[3]),
        1
      );
      let imgToPaint, tmpCanvas, tmpCtx;
      
      if (
        (typeof HTMLElement === "function" && imgData instanceof HTMLElement) ||
        !imgData.data
      ) {
        imgToPaint = imgData;
      } else {
        tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", width, height);