Browse Source

add code to parse bits per component information for images

Andreas Gal 14 years ago
parent
commit
386d70f33c
  1. 15
      pdf.js

15
pdf.js

@ -1904,6 +1904,21 @@ var CanvasGraphics = (function() { @@ -1904,6 +1904,21 @@ var CanvasGraphics = (function() {
if (!IsBool(imageMask))
imageMask = false;
// JPX/JPEG2000 streams directly contain bits per component
// and color space mode information.
var bitsPerComponent = image.bitsPerComponent;
var csMode = image.csMode;
if (!bitsPerComponent) {
bitsPerComponent = dict.get("BitsPerComponent") || dict.get("BPC");
if (!bitsPerComponent) {
if (imageMask)
bitsPerComponent = 1;
else
error("Bits per component missing in image");
}
}
var tmpCanvas = document.createElement("canvas");
tmpCanvas.width = w;
tmpCanvas.height = h;

Loading…
Cancel
Save