File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2082,10 +2082,13 @@ class PDFDocument {
20822082 const obj = Object . create ( null ) ;
20832083 obj . dict = await this . toJSObject ( dict , false ) ;
20842084
2085- if (
2086- isName ( dict . get ( "Type" ) , "XObject" ) &&
2087- isName ( dict . get ( "Subtype" ) , "Image" )
2088- ) {
2085+ if ( isName ( dict . get ( "Subtype" ) , "Image" ) ) {
2086+ const isImageMask = dict . get ( "ImageMask" ) === true ;
2087+ if ( isImageMask ) {
2088+ dict . set ( "ImageMask" , false ) ;
2089+ dict . set ( "IM" , false ) ;
2090+ value . numComps = value . bitsPerComponent = 1 ;
2091+ }
20892092 try {
20902093 const pdfFunctionFactory = new PDFFunctionFactory ( {
20912094 xref : this . xref ,
@@ -2113,6 +2116,11 @@ class PDFDocument {
21132116 } catch {
21142117 // Fall through to regular byte stream if image decoding fails.
21152118 }
2119+ if ( isImageMask ) {
2120+ dict . set ( "ImageMask" , true ) ;
2121+ delete value . numComps ;
2122+ delete value . bitsPerComponent ;
2123+ }
21162124 }
21172125
21182126 if ( isName ( dict . get ( "Subtype" ) , "Form" ) ) {
You can’t perform that action at this time.
0 commit comments