SMaskInData overrides Mask - but it's not clearly stated
In Table 87 (Additional Entries in Image Dictionary), for the SMask entry, it reads:
If present, this entry shall override the current soft mask in the graphics state, as well as the image’s Mask entry, if any. However, the other transparency-related graphics state parameters — blend mode and alpha constant — shall remain in effect.
However, neither statement is duplicated in the SMaskInData entry.
It is, however stated later on in 11.6.4.3, bullet three
If SMaskInData is present with a value other than 0, the embedded soft-mask shall override any explicit or colour key mask specified by the image dictionary’s Mask entry, and it shall override, for this image object only, the current soft mask in the graphics state.
Apparently some implementations (e.g. Chrome) didn't read far enough and apply both Mask and SMaskInData.
Recommend that we copy the text from the SMask entry into the SMaskInData entry for consistency.
This may already have been covered somewhat by Errata #13 which we resolved as https://pdf-issues.pdfa.org/32000-2-2020/clause08.html#Table87.
@petervwyatt that errata is good, but doesn't cover this particular item since the piece of relevant text is in a different section than the one addressed in the errata.
Finally getting back around to errata... I'm also seeing a few other related issues
- Table 87, SMask also states: "If SMask is absent and SMaskInData has value 0, the image shall have no associated soft mask (although the current soft mask in the graphics state may still apply)."
- Table 87, SMaskInData for value 0 states: "If present, encoded soft-mask image information shall be ignored."
- Clause 7.4.9 JPXDecode, 3rd last bullet states "SMaskInData specifies whether soft-mask information packaged with the image samples shall be used (see 11.6.5.2, "Soft-mask images"); if it is, the SMask entry shall not be present. If SMaskInData is non-zero, there shall be only one opacity channel in the JPEG 2000 data and it shall apply to all colour channels."
there are differences here between "shall have no associated soft mask" and "shall be ignored"/"shall be used" - is it allowed to have a soft mask in the data which must then subsequently be ignored or not??
- Table 87, SMaskInData also states: "If this entry has a non-zero value, SMask shall not be specified", but this is not repeated in the SMask cell but should be as it is a file format requirement.
The notes for SMask and SMaskInData stating "NOTE Interactions between SMask, SMaskInData and the current soft mask in the graphics state are set out in clause 11.6.4.3, "Mask shape and opacity". should also explicitly reference the Mask key to tie everything together. And this same note should also be added to the Mask entry in Table 87 since clause 11.6.4.3 discusses Mask...
To @lrosenthol original suggestion, add the following text from Table 87 SMask to the Table 87 SMaskInData entry for the value 0 (since that is the only time SMask is allowed when SMaskInData is also present):
"If present, SMask shall override the current soft mask in the graphics state, as well as the image’s Mask entry, if any. However, the other transparency-related graphics state parameters — blend mode and alpha constant — shall remain in effect."
PDF TWG want all precise wording changes listed out.
Circling back around to try and get consensus: where do people stand between file format requirements ("shall not be present") vs processor requirements ("shall be ignored" / "shall be used")? Or is this case-by-case? Or even both (which is slightly confusing, but that does result in a deterministic rendering appearance under all conditions!)?
I personally think file format requirements are preferred since these can always be validated ("shall not be present") AND we should add a matching processor requirement for important rendering aspects "However if present, it shall be ignored".
I agree with all that has been said here. We should copy the para from SMask to SMaskInData and add an additional statement to SMaskInData that if SMask is also present it shall be ignored (maybe this should be a recommendation only since it shall not be present altogether).
PDF TWG agree to both file format and backup processor requirement.
Trying to pull all proposed changes (italicised text below) together in a single place covering both file format and processing requirements (in the event of keys being present when they shouldn't be so as to ensure consistent appearance):
-
Table 87, Mask - "If ImageMask is true, this entry shall not be present (if present, it shall be ignored)".
-
Table 87, Mask - duplicate the existing NOTE from SMask and SMaskInData cells to this cell
-
Table 87, ImageMask - "If this flag is true, the value of BitsPerComponent, if present, shall be 1 and Mask and ColorSpace shall not be present (if present, they shall be ignored)."
-
Table 87, SMask - add new sentence "SMask shall not be present if SMaskInData has a non-zero value (if present, SMask shall be ignored)." to mirror what is already stated in the *SMaskInData description.
-
Table 87, SMaskInData - "If this entry has a non-zero value, SMask shall not be specified (if present, SMask shall be ignored)"
-
Table 87, SMaskInData - add new sentence (duplicating what is already stated elsewhere in 7.4.9. JPXDecode 3rd last bullet: "_ If SMaskInData is non-zero, there shall be only one opacity channel in the JPEG 2000 data and it shall apply to all colour channels._"
-
Table 87 SMaskInData - add the following text from SMask for when the value 0 (since that is the only time SMask is allowed when SMaskInData is also present):
"If present, SMask shall override the current soft mask in the graphics state, as well as the image’s Mask entry, if any. However, the other transparency-related graphics state parameters — blend mode and alpha constant — shall remain in effect."
PDF TWG agree