diff --git a/src/core/image.js b/src/core/image.js index 1adad5e29..2e01cbadf 100644 --- a/src/core/image.js +++ b/src/core/image.js @@ -228,14 +228,14 @@ var PDFImage = (function PDFImageClosure() { PDFImage.prototype = { get drawWidth() { - if (!this.smask) - return this.width; - return Math.max(this.width, this.smask.width); + return Math.max(this.width, + this.smask && this.smask.width || 0, + this.mask && this.mask.width || 0); }, get drawHeight() { - if (!this.smask) - return this.height; - return Math.max(this.height, this.smask.height); + return Math.max(this.height, + this.smask && this.smask.height || 0, + this.mask && this.mask.height || 0); }, decodeBuffer: function PDFImage_decodeBuffer(buffer) { var bpc = this.bpc; diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 0489087bf..fe42cdffe 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -66,3 +66,4 @@ !bug946506.pdf !issue3885.pdf !bug859204.pdf +!issue4246.pdf diff --git a/test/pdfs/issue4246.pdf b/test/pdfs/issue4246.pdf new file mode 100644 index 000000000..736558e02 Binary files /dev/null and b/test/pdfs/issue4246.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 295075d60..70d93e241 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1561,5 +1561,12 @@ "firstPage": 4, "lastPage": 4, "type": "eq" + }, + { "id": "issue4246", + "file": "pdfs/issue4246.pdf", + "md5": "ed81787b83cc317c9f049643b853bea3", + "rounds": 1, + "type": "eq", + "about": "Image mask in higher resolution than the image itself" } ]