Repository navigation
Conversation
The PNG specification stores a grey or RGB tRNS key as 16-bit words whatever the depth and requires a decoder to mask the bits above the depth to 0. The loader rescaled the raw word, so a valid PNG with stray high bits got a Mask entry above 2^BitsPerComponent - 1, which ISO 32000-2 8.9.6.4 forbids, and readers painted the pixel the PNG marks transparent. Mask first, then rescale. Only a PNG whose key has bits above the depth changes output. The audit's pin is replaced by its accept test and the three inputs join the colour-key kinds.
ExtraSamples 1 means the colour samples are already multiplied by alpha, which is the pre-blending of ISO 32000-2 11.6.5.2 with a black matte. A soft-mask image with no Matte says its data are not pre-blended, so readers multiplied twice and the image came out darker than the source. Write /Matte [0 0 0] on the soft mask and keep the samples as stored: exact, where un-multiplying in the loader would round at 8 bits. Only an RGBA TIFF with ExtraSamples 1 and non-opaque alpha changes output.
ISO 32000-2 7.4.9 limits the data of an image XObject to the JPX baseline set of features. The loader read the SIZ marker for size, channel count and depth but never its Rsiz field, so a codestream declaring Part 2 capabilities was wrapped and written. Read Rsiz from a bare codestream and from the jp2c box of a JP2 file, and refuse bit 15 with InvalidDataException. The text that defines the baseline set is not held here, so only that bit is checked, and the doc says so. A codestream behind a JP2 header that does not start with SOC and SIZ stays unexamined, as before.
JpegImageLoader wrote /DeviceRGB for every component count other than 1 and 4 and accepted every frame type and precision. JpxImageLoader wrote a device name from the channel count whatever the colr box said, and Table 87 says a ColorSpace that is present replaces the colour specification in the JPEG 2000 data. JPEG: refuse a component count other than 1, 3 or 4, a precision other than 8 and a frame type other than SOF0 to SOF2, which also covers a JPEG strip of a TIFF. JPEG 2000: refuse a bare codestream, or a JP2 file with no jp2h box, of a channel count other than 1, 3 or 4, and a JP2 file whose only colour specification is CIEJab; leave ColorSpace out when the colr boxes name no sRGB, greyscale or CMYK space (ICC, sYCC and the other enumerated spaces). A JP2 file of two channels beside a greyscale colr box, and one with a bpcc box, still pass through: ISO 32000-2 7.4.9 allows channels of different depths, so those are invalid only under PDF/A and wait for a ruling. Every other JPEG and JP2 file keeps its bytes.
Keeps both sides of the CHANGELOG Fixed list: the four image entries and the entries main gained since.
A JP2 file with a channel count other than 1, 3 or 4, or with channels of different bit depths, is valid under ISO 32000-2 7.4.9 and fails ISO 19005-2 6.2.8.3, so the Kernel loader keeps passing it through. The Layout save now reports each under a PDF/A-2b, 2u or 2a claim as the new error LayoutDiagnosticCode.JpxImageNotAllowedByPdfA (501), naming the image and the clause, so StrictDiagnostics refuses it. Without a claim, and under PDF/UA-1, nothing is reported. The loader records the ihdr channel count and whether the bpcc box gives different depths on the image, internally. The two audit accept tests become tests of the report and of the strict refusal; the pins of today's bytes stay. The loader docs carry the Do not pass.
The documentation test requires every LayoutDiagnosticCode to appear in the Document.Diagnostics remarks; the new code was missing.
Review of the #763 loader change found three gaps. A JP2 file with two or more colr boxes and none a device space lost its ColorSpace and then failed PDF/A-2b in veraPDF, where it had passed with the name; only a file with exactly one such box is now written without one. A jp2h file whose ihdr channel count the device name does not fit (one channel beside sRGB, five with no colr box) is refused, as the same data with no jp2h already was, because 7.4.9 matches the colour channels to the components; one channel beyond the space is read as an opacity channel, a CMYK colr box names DeviceCMYK where only that fits, and a pclr or cmap box keeps the name. The PDF/A-2 report for JP2 files no longer quotes the image's alternative text, so the Layout diagnostics still retain no caller text, and a bpcc box that differs only in sign is named as such. The doc sentences that called the kept files valid now say what the code does. A test covers the band logo report, and the conformance rows for #763, #764, #768 and #770 follow in the next commit.
The G4 rows still said gap and cited ten tests that no longer exist under those names, five of them as skipped. Each row now gives the verdict after the fix and names the tests that run, and the PDF/A row says which reading of 6.2.8.3 still needs the standard's text.
… accepts The test built a JP2 file of three channels beside a greyscale colr box and expected DeviceGray, which is the file the loader now refuses because three channels do not fit DeviceGray. Two channels is greyscale plus one opacity channel, and it still shows the colr box deciding over the DeviceRGB that the channel count would give.
…e 6.2.8.3 text A JP2 file with a jp2h box now has its colour channels counted: the type 0 entries of its cdef box, or every channel when it has none (ISO/IEC 15444-1, I.5.3.6). The device name the loader writes must have exactly that many components (ISO 32000-2, 7.4.9: the ordinary colour channels shall match the components of the colour space) or the file is refused. This replaces the earlier rule that let one channel beyond the name through as an opacity channel, which refused a valid RGB file with two opacity channels declared in a cdef box and kept a greyscale file of two colour channels. A name that already has the right count keeps main's bytes, so a CMYK colr box over five channels is DeviceRGB again and refused (five colour channels). A cmap box without pclr is no longer a palette. A file with no jp2h box is refused before its colour space is chosen, so its message names the missing box, and a jp2h box without ihdr names the codestream as the source of the count. The Layout report (501) follows ISO 19005-2, 6.2.8.3: more than one colour specification without exactly one APPROX of 1, a colr METH other than 1, 2 or 3, and colour channels of different bit depth, depth only and not opacity channels. It no longer reports a channel count or a sign-only bpcc difference. Docs state where veraPDF differs. The class summary, the 501 remarks and the CHANGELOG say what the code does.
…report The ISO 32000-2 7.4.9 row now says the colour channels are counted from the cdef box, or every channel without one, and the name must have that many components. The ISO 19005-2 6.2.8.3 row lists the three findings the Layout report follows and says where veraPDF differs, and drops the sign-bit open point, which the clause text settles.
The conformance doc paragraph on 6.2.8.3 claimed the clause follows from 6.2.4.3. The reading of 2026-11-30 shows APPROX and METH apply whether or not ColorSpace is written, the channel limit counts colour channels, and the depth rule leaves the sign out. The Rsiz comments, the loader docs and the CHANGELOG cite ISO/IEC 15444-1 Table A.10 for bit 15, and say bit 14 is not examined.
…ludes Refusing every codestream with Rsiz bit 15 set also refused baseline files that 2.3.3 wrote validly. ISO/IEC 15444-2:2004, M.9.2.3, defines the JPX baseline codestream as Part 1 plus only the irreversible decorrelation and non-linearity extensions, and Table A.2 says which Rsiz bits are required to decode. With bit 15 set the loader now refuses only when bit 0, 1, 4, 5, 6, 7, 10 or 11 is set. Bit 15 alone, the useful bits 2, 3 and 9, and the multiple component transformation bit 8 pass; the MCC and MCO limits that the baseline puts on bit 8 are not checked. Bit 14 (extended capabilities through a CAP marker, such as the HT block coder) is refused. The reach is unchanged: a bare codestream, and the jp2c of a JP2 file whose codestream starts SOC then SIZ. The loader, LayoutImage.FromBytes and the CHANGELOG entry state the new rule, and the tests pin each required bit refused, each passing bit kept byte for byte, and bit 14 refused.
… cdef channels once A JP2 file with exactly one colr box naming no device space is written with no /ColorSpace, and its colour channels were never counted, so a file whose sYCC box sat over two channels or whose ICC profile held three colours over five was passed on and no longer reported. The colour channels (cdef type 0 entries, else every channel) must now have as many components as that box: an enumerated space by the definition in ISO/IEC 15444-2:2004 Table M.25, an ICC profile by the data colour space in its header (ICC.1 Table 19). No fit is InvalidDataException, as for a device name. A space whose components the loader does not know is not compared. A file written with no ColorSpace whose colour channels number other than 1, 3 or 4 is reported under a PDF/A-2 claim. A cdef box that names a channel twice, or one the image does not have, counted its entries, so a CMYK box over a one- or three-component codestream gave DeviceCMYK. Distinct channels below the channel count are counted now, which keeps main's name where it fits and never writes a name whose components differ from that number. A cmap box without a pclr box is forbidden in a JP2 file (15444-1 I.5.3.4) and stays judged by the channel count, with the message saying so. In a JPX file (brand jpx or jpxb) no sentence of 15444-2:2004 M.5.1.2, M.11.5 or M.11.6 ties it to a palette, so such a file keeps main's name unchecked. A jplh box is not written with the file; the refusal for a JPX file that has one says so instead of claiming the channels have no definition. The PDF/A report gains two findings from 6.2.8.3: the colour-channel count and a depth outside 1 to 38 (15444-1 Table I.6). Depths are read from the bpcc box, else from the codestream where the loader takes the dimensions from it, else from ihdr, so a bare codestream whose components differ in depth is reported. The Rsiz reach is stated as it is: bare codestream, the jp2c that starts SOC then SIZ, and a JP2 file whose dimensions come from the codestream. The HT block coder claim is dropped; Table A.10 says only "extended capabilities through a CAP marker". A short cdef box is skipped and the first readable one is read, and the message says "the loader can read". Tests pin METH 4 and reserved Rsiz bits 12 and 13.
…le and the Rsiz reach The 7.4.9 colour-space row now says a lone non-device colr box is checked against the colour channels (enumerated spaces by ISO/IEC 15444-2:2004 Table M.25, ICC profiles by the header colour space), that cdef channels are counted once, and that a JPX file's cmap box without pclr keeps the name. The 770 row names the three cases in which Rsiz is read. The 6.2.8.3 row adds the colour-channel count for a file written with no ColorSpace, the 1 to 38 depth range and where the depths are read from.
…Table M.25 The two counts are in ISO/IEC 15444-1, which is not held; the comment now says they rest on the device spaces the loader has always chosen.
One conflict: PublicAPI.Unshipped.txt in Layout, where this branch's JpxImageNotAllowedByPdfA entry and main's range-band entries sit side by side; both kept.
…on-baseline spaces A JP2 file with one colr box that names no device space was refused whenever the colour channels differed from that box's components. ISO 32000-2, 7.4.9, lets a ColorSpace that is present replace the colour specification of the data and asks only that the ordinary colour channels match its components, and no sentence of ISO/IEC 15444-1:2024 found in a search of its Annex I ties the channel count to the colour count of the space when there is no cdef box. So the file now keeps the name the channel count chooses where that name has as many components as the colour channels, which is the bytes written before, and is refused only where it has not. An enumerated space outside the JPX baseline list of ISO/IEC 15444-2:2004, M.9.2.4, other than CMYK is refused when it is the only colour specification: 7.4.9 allows no other enumerated space, so no ColorSpace makes such a file valid and the file written before was invalid too. The message names the value as an unsigned number, so the top of the 32-bit field reads as written. A cdef entry for a channel the image lacks now counts as the definition of a colour, capped at the channel count. I.5.3.6 asks for one definition per colour and bounds no channel number, and no sentence found makes such a file non-conforming, so the RGB file whose cdef names channels 0, 1 and 9 keeps its name. A colour with no entry is still not counted. Tests pin the ICC header boundary at 20 bytes, every data colour space of ICC.1 Table 19 and the zero-dimension ihdr reach of the Rsiz check. The depth range, the Rsiz reach and the lone-box prose are corrected in the loader summary, the CHANGELOG, the conformance row and the Layout remarks.
…hold The colour channels of a JP2 file are the channels the image has that a type 0 entry of a usable cdef box names, or every channel when the box is absent or leaves a channel undescribed. An entry for a channel the image lacks describes nothing. The reading is stated once on JpxImageLoader and every other place points to it. A JP2 file none of whose readable colr boxes is an allowed colour specification (an ICC profile, CMYK, or a baseline enumerated space other than CIEJab) is refused, as is a colour channel deeper than 38 bits, since ISO 32000-2, 7.4.9, allows neither. The depth finding of the PDF/A report goes with it. LayoutImage no longer promises that all unwritable data is refused; it lists what is.
…our count A cdef box that leaves a channel undescribed has two defensible counts, the channels its type 0 entries name and every channel, because ISO/IEC 15444-1, I.5.3.6, asks for a complete list and does not define the word. The loader keeps the name when it has as many components as either count and refuses only when it fits neither, so the box creates no refusal. A depth over 38 bits is refused only for a channel the box names.
A cdef box that leaves a channel undescribed has two readings of the colour channels. The loader judged the name against the counts of both readings and the depth against the named channels only, so a file whose every reading broke one of the two rules was kept with main's bytes. A reading now keeps the file only if the name written has that reading's colour-channel count and every colour channel of that reading is 1 to 38 bits deep; the file is refused when no reading passes both, with a message that names the failed check of each. The PDF/A report is judged under the reading that is kept. A bpcc box with more entries than the image has channels is not a conforming JP2 file (I.5.3.2): its extra entries are no colour channels, and a deep one is refused with that said instead of as a colour channel. The refusal for a file with no allowed colour specification lists the allowed values. Stale comments, a renamed method in a comment, and the LayoutImage depth item are corrected, and the two mutation survivors of the last round get tests.
The refused-list item for a colour channel deeper than 38 bits had no qualifier, while the loader does not read the depths of a file with a palette or a JPX cmap box, a depth only the codestream shows beside a usable ihdr box, or an ihdr BPC of 255 with no bpcc box. The item now says so and points to the loader.
…channel The principle says a complete cdef box has one reading, judged the same way as an incomplete one. A deep colour channel under such a box was covered only through a file with no box, so a test now covers it. The summary also says that the extra bpcc entries refuse only a file whose depths are read.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #768
Closes #764
Closes #770
Closes #763
What changes
Four image-loader gaps the ISO audit filed, smallest first, plus one Layout report for what the loaders pass through under a PDF/A-2 claim.
PngImageLoadermasks a grey or RGBtRNSword to the bit depth before it rescales it (PNG 3rd edition: decoders mask the other bits to 0). ISO 32000-2, 8.9.6.4: each colour-key integer shall be in 0 to 2^BitsPerComponent - 1.01 10on 8-bit grey now writes[16 16](was[272 272]),00 15on 4-bit grey[85 85](was[357 357]),01 FF 00 00 00 00on 8-bit RGB[255 255 0 0 0 0](was[511 511 0 0 0 0]).TiffImageLoaderwrites/Matte [0 0 0]on the soft mask whenExtraSamplesis 1 (TIFF 6.0: pre-multiplied colour). ISO 32000-2, 11.6.5.2: withoutMattethe data are not pre-blended. Samples are written as stored, so a colour above its alpha (not a TIFF 6.0 file) is written as it is and the loader doc says so.ExtraSamples1 and alpha below 255 somewhere, 8 and 16 bit, under eitherImageBitDepth.JpxImageLoaderreadsRsizand throwsInvalidDataExceptionwhen bit 15 (Part 2 capabilities) is set together with any of bits 0, 1, 4, 5, 6, 7, 10 or 11, and when bit 14 is set. The field is read in three cases: a bare codestream, thejp2cbox of a JP2 file whose codestream starts SOC then SIZ, and a JP2 file whose dimensions come from the codestream because it has nojp2hbox or no usableihdrbox, one that is absent or has a height or width of 0 (SIZ is found by scanning past the marker segments before it). A JP2 file with a usableihdrbox and a codestream that does not start SOC then SIZ is not examined. ISO 32000-2, 7.4.9: data limited to the JPX baseline set. ISO/IEC 15444-2:2004 (the edition ISO 32000 and ISO 19005-2 cite), M.9.2.3: the baseline codestream is Part 1 plus only the irreversible decorrelation and non-linearity extensions; Table A.2 names the bits that are required to decode (0, 1, 4, 5, 6, 7, 8, 10, 11) and the ones that are useful (2, 3, 9). Bit 8 (multiple component transformation) passes because the baseline allows the restricted decorrelation; its MCC and MCO limits are not checked. Bit 14: ISO/IEC 15444-1 Table A.10, extended capabilities through a CAP marker.Rsizbit 14 set, or bit 15 with one of the listed required bits (new refusal). Bit 15 alone, bits 2, 3, 8 and 9 keep main's bytes.JpegImageLoaderrefuses a component count other than 1, 3, 4, a precision other than 8, and a frame type other than SOF0 to SOF2 (also reached through a TIFF JPEG strip).JpxImageLoaderrefuses a bare codestream or a JP2 file with nojp2hbox of a channel count other than 1, 3, 4, and a JP2 file none of whose readablecolrboxes is an allowed colour specification (below). For a JP2 file with ajp2hbox it counts the colour channels (below) and refuses the file unless the device name it writes has exactly that many components. A JP2 file with exactly onecolrbox that holds an ICC profile or names an enumerated space other than 12, 16, 17 is written with no/ColorSpacewhen its colour channels have as many components as that box (enumerated space by the colour model it names in ISO/IEC 15444-2:2004 Table M.25, ICC profile by the colour space in its header, ICC.1 Table 19); when they do not it keeps the device name the channel count chooses if that name has as many components as the colour channels (main's bytes), and is refused if it has not. It also refuses a file when every reading of its colour channels that the name fits has a colour channel deeper than 38 bits.PdfImageXObjecttakes a nullable colour space (internal), and writes no/ColorSpaceentry fornull.Layout files that change besides
LayoutImage.cs(XML documentation onFromBytes,FromFileandFromStream):LayoutDiagnosticCode.cs(the new member and its documentation),PublicAPI.Unshipped.txt,Document.cs(one documentation sentence),LayoutDiagnosticSink.cs(the clause),Rendering/ImageDiagnostics.cs(new),LayoutImageRenderer.csandDocumentRenderer.Zones.cs(one call each). New public member:LayoutDiagnosticCode.JpxImageNotAllowedByPdfA = 501.The rule for a JP2 file with a
jp2hboxISO 32000-2, 7.4.9: the number of "ordinary colour channels" in the JPEG 2000 data shall match the number of components in the colour space (ISO 32000-1: "colour channels"). ISO/IEC 15444-1, I.5.3.6 (read on NEN, paraphrased): a codestream that holds only colour channels in colour order has no
cdefbox, and any opacity channel needs one. The colour channels are counted as theJpxImageLoaderclass summary states once (a reading of I.5.3.6, not a quoted requirement: the clause does not define "complete", and no sentence found bounds the channel number of an entry). Acdefbox that leaves a channel undescribed has two readings, the channels it names with a type 0 entry and every channel. A reading keeps the file only if the whole file is valid under that same reading: the name written has that reading's colour-channel count and every colour channel of that reading is 1 to 38 bits deep. The file is written when at least one reading passes both checks (with the name main wrote,DeviceCMYKwhere a CMYKcolrbox fits four colour channels, or no/ColorSpacewhere onecolrbox that is not a device space fits) and is refused when none does, with a message that names the failed check of each reading. A box that describes every channel, and a file with no box, have one reading, judged the same way. The device name the loader chooses (as before: the last enumerated value, else the channel count) must have exactly that many components, or the file is invalid under 7.4.9 andLoadthrowsInvalidDataException. WhereColorSpaceis left out (one non-devicecolrbox) the same count is compared with that box's components, and a mismatch is not by itself a refusal: 7.4.9 lets a presentColorSpacereplace the file's specification, and the NEN search of 15444-1:2024 Annex I found no sentence that ties the channel count to the colour count of the space where there is nocdefbox, so the file keeps main's name where that name has as many components as the colour channels and is refused where it has not. The refusal that does not depend on the channels is a file none of whose readablecolrboxes is an allowed colour specification: an ICC profile (method 2 or 3), CMYK (12), or an enumerated space of the baseline list (14 CIELab, 16, 17, 18 sYCC, 20 e-sRGB, 21 ROMM-RGB, 24 e-sYCC) other than 19, which 7.4.9 excludes. The refused enumerated values are 0 to 11, 13, 15, 19, 22, 23 and every value above 24, and the refused methods are any other than 1, 2 and 3; a lone box of those kinds, two or more, and a vendor box beside only such boxes are refused, whatever the channels, because 7.4.9 limits the data to the baseline set except 19 (15444-2:2004 M.9.2.4 asks of it a colour specification from its list) and noColorSpacemakes such a file valid. One allowed box beside others is enough. A box too short to read (under 3 bytes, or method 1 under 7) is a colour specification of neither kind; a file with only such boxes, and a file with nocolrbox, are not refused for it. An ICC profile whose header is cut short or names a signature outside Table 19 is not compared. A CMYKcolrbox with four colour channels gives/DeviceCMYKwhere the chosen name is another. Opacity, premultiplied opacity and unspecifiedcdefentries are not counted; acdefbox too short for its own entry count is skipped and the first one long enough is read. A file with apclrbox is not checked against its channel count (the palette changes what the channels are and is not read), and so does a JPX file (ftypbrand or compatible brandjpxorjpxb) with acmapbox and nopclr: 15444-2:2004 M.5.1.2 numbers channels by thecmapentries and no sentence of M.11.5 or M.11.6 ties the box to a palette (searched the held text). In a JP2 file acmapbox withoutpclris not allowed (15444-1 I.5.3.4), so the file is judged by its channel count. The check reads thejp2hbox only: a JPX file'sjplhbox is not written with the file, and the refusal message says so.Measured
/ColorSpace, Kernel save, no claim (mainc108a11, this branch64c49be; the probe prints the resolvedVellumPdf.Kernel.dllpath and version of each).git diff v2.3.3 origin/mainis empty forJpxImageLoader.csandPdfImageXObject.cs(searched those two paths), so main's JP2 output is v2.3.3's. G, R, C =DeviceGray,DeviceRGB,DeviceCMYK; X = refused; - = noColorSpace. Each cell is main / branch.No
cdefbox,ihdrchannel count 0 to 8:colrWith a
cdefbox marking k colour channels and the rest opacity (2 to 6 channels, every k measured): a greyscalecolris written only for k = 1 (G/G); an sRGBcolronly for k = 3 (R/R); nocolrbox for k = 3 (R/R) or, at four channels, k = 4 (C/C); a CMYKcolrbox for k = 3 (R/R) and k = 4 (C/C at four channels, R/C at five and six); every other k is refused. Named inputs: RGB with five channels,cdefthree colour and two opacity: R/R; same with a premultiplied channel: R/R; greyscale two channels, one colour and one opacity: G/G; greyscale with two colour channels: G/X; CMYK with six channels, four colour: R/C;cdefwith unspecified entries only: R/X; twocdefboxes, the first decides; a truncatedcdefis judged as nocdef: R/X at five channels;pclralone or withcmap, at 1, 2 or 7 channels: kept;cmapalone: refused at 1 and 2 channels beside sRGB and at 5 beside greyscale, R/R at 3 channels beside sRGB; noihdrbox, 2 or 5 channels: refused, with the codestream named in the message;ihdrof 0 channels: refused. A JP2 file with nojp2hbox of 2, 5, 6, 8 or 16 channels: R/X, with 1, 3 or 4: unchanged.Where main's name already has the right count the bytes are main's: 1 channel beside a CMYK
colr(G), 3 beside CMYK (R), 4 beside CMYK or none (C). Changed relative to the previous head of this PR: 2 and 3 channels beside greyscale, 4 beside sRGB and five beside CMYK are refused (nocdefbox, so every channel is a colour channel), and RGB or CMYK files with acdefbox that declares opacity channels are written.Other rows (valid under ISO 32000-2, no claim)
Maskoutside the sample rangeMatteMatte [0 0 0]Rsizbit 14, or bit 15 with a required bit other than 8DeviceRGBover data of another count/BitsPerComponent 8jp2h)DeviceRGBplus an sRGBcolrover the wrong channel countcolrbox: sYCC, e-sRGB, ROMM, e-sYCC, CIELab, ICC, channels fitting itColorSpaceColorSpacereplaces the file's colour specification; writer shall keep samples consistentColorSpacewhose components match the ordinary colour channelscolrboxes is allowed: a lone CIEJab, a lone enumerated value outside the list (0 to 11, 13, 15, 22, 23, 25 and above), a lone vendor or reserved method, two or more such boxes, a vendor box beside only such boxesColorSpacemakes such a file validbpcc,ihdror codestream; opacity channels and palette files are not read for it)bpccbox with more entries than the image has channels, an entry past the last channel deeper than 38 bits (r10:d3-bpcc4-nc3-last39,-cdef)cdefbox leaves a channel undescribed and under no reading of which the whole file is valid: the name has neither count, or the reading whose count it has holds a colour channel deeper than 38 bits (r7:cdef-oor-gray1-opacity,r7:cdef-rgb-c5-oor3,r9:undescribed-rgb4-ch1,r9:undescribed-depth49-rgb3,r10:d1-undescribed-ch2-bpcc39-rgb3,r10:d1-undescribed-ch3-bpcc39-cmyk4,r10:d1-empty-cdef-ihdr39-rgb3,r10:d1-oor-only-ihdr39-grey1)A
colrbox shorter than 3 bytes, or of method 1 and shorter than 7 bytes, is neither allowed nor refused for itself and keeps the device name. A lone vendor box (method 4) and a lone method 9 box are refused, above.The PDF/A report (501)
ISO 19005-2, 6.2.8.3, read on NEN on 2026-11-30 (paraphrased in the repository's notes, quoted nowhere): colour channels 1, 3 or 4; exactly one colour specification with APPROX 1 where there are several; METH 1, 2 or 3; one bit depth for all colour channels (the sign is not part of the depth, ISO/IEC 15444-1 Table A.11; opacity channels are not covered). ISO 32000-2, 7.4.9, requires none of the first four, so the Kernel loader writes such a file and a Layout save under PDF/A-2b, 2u or 2a reports it as
LayoutDiagnosticCode.JpxImageNotAllowedByPdfA(501), an error, soStrictDiagnosticsrefuses the save. Four findings, one item each per element: more than one colour specification and not exactly one with APPROX 1; a METH other than 1, 2 or 3; colour channels of different depth; and, for a file written with no/ColorSpace, a number of colour channels other than 1, 3 or 4 (a name already has one of those counts). 7.4.9 requires none of these; it does limit bits per sample to between 1 and 38, so the loader refuses a deeper colour channel (15444-1 Table I.6) and the report never sees one. Colour channels are as the loader defines them, under the reading the file is kept under; a file with a palette or a JPXcmapbox is not compared. Depths are read from thebpccbox, else from the codestream where the loader took the dimensions from it (a bare codestream, nojp2h, no usableihdr), else fromihdr, which gives none when its BPC is 255 and there is nobpccbox; a depth only the codestream shows beside anihdrthat says otherwise is not compared. The report follows the clause and not veraPDF 1.30.4, which checks APPROX and METH only where the dictionary has noColorSpace, fails a sign-onlybpccdifference, and fails a file with opacity channels on itsihdrcount. The message names the image by its size and quotes no alternative text; the item carries the clauseISO 19005-2:2011, 6.2.8.3. Without a claim and under PDF/UA-1 nothing is reported; a Kernel-only document has no report (the loader docs say so with a "Do not pass" naming 3.0 and #474).veraPDF 1.30.4, 2b, re-measured at head
7e6f6c7and main1b53e4f: the 14 two- and one-box inputs (r2:one-andr2:two-families) at 1, 3 and 4 channels, each saved by the Kernel and by Layout. Main has 28 saves per count; this branch has 26, because the lone enumerated value 99 (r2:one-e99) is now refused. At 1 channel 28 of 28 pass on main and 26 of 26 on this branch; at 3 channels 28 of 28 and 26 of 26; at 4 channels 0 of 28 pass on main and 4 of 26 on this branch, every failure on 6.2.4.3-3 (DeviceCMYK). The 4 passes are the one-box ICC inputs, which write no name; a lone sYCC box over four channels now keeps main'sDeviceCMYKand fails like main.Valid inputs keep their bytes
1,432 generated inputs (every kind the G4 fixtures build, parametric PNG, TIFF, BMP, GIF, JPEG, JBIG2 and JPEG 2000 variants, and 529 JP2 inputs covering every
colrand channel count above,cdefshapes, palettes and malformed boxes), 10,324 saves per side (Kernel None and 2b, Kernel withReduceToEight, Layout under None, 2b, 2u, 2a and UA-1), whole-file SHA-256 under pinned timestamp and document id, plus exception type and message and diagnostic codes. Main against this branch:jp2-c2-grey,jp2-c3-grey-enum,jp2-c1-srgb-enum,jp2-c2-nocolr,jp2-c5-nocolr,jp2-c5-cmyk-enum,jp2-c1-noihdr-srgb,jp2-c4-noihdr-srgb,jp2-c4-xmlbox,jp2-c4-bpcc-same,jp2-c4-srgb-alpha: nocdefbox, so the extra channels are colour channels); 15 gain only the 501 item (two colour specifications with no APPROX 1, a vendor box of METH 4 beside an allowed box,bpccof 8, 8, 4 bits), their bytes identical; 2 lose/ColorSpace(jp2-c2-sycc,jp2-c5-icc, one non-device box).Rsizvalues, each as a bare codestream, in a JP2 file, and in a JP2 file with nojp2hbox) differ in 48, the 16 values 0x8001, 0x8002, 0x8010, 0x8020, 0x8040, 0x8080, 0x8400, 0x8800, 0x860D, 0x8F0C, 0x8FFF, 0x4000, 0x4001, 0xC000, 0x7FFF and 0xFFFF, and keep 21, the 7 values 0x8000, 0x8004, 0x8008, 0x8100, 0x8200, 0x8208 and 0x830C. The 228Rsizinputs the issues do not name (ten values from 0 to 0x3FFF, as a bare codestream and in a JP2 file) are identical to main.cdefreview: 74 identical, 455 differ (refused, renamedDeviceCMYK, withoutColorSpace, or 501 only), each a row above.Lone
colrbox,cdefcounting and depths: measured against mainProbe of 1,814 inputs (the 1,695 of the previous round plus 119 new: every lone enumerated value 0 to 30 and the ends of the 32-bit field, lone baseline spaces and ICC profiles at 1 to 5 channels, ICC header lengths 19, 20 and 21, lone boxes with a
cdefbox, out-of-rangecdefentries), 12,999 saves per side. Main (1b53e4f) against head7e6f6c7, the resolvedVellumPdf.Kernel.dllandVellumPdf.Layout.dllprinted by the probe for each: 908 inputs identical on every save, 611 refused, 187 with other bytes and no refusal, 108 with only a changed diagnostic list. No input goes from refused on main to saved. Against the previous head64c49be, 116 of the 1,695 earlier inputs differ: 43 lone non-baseline enumerated spaces that were written are now refused (rows above), 30 that were refused for their channel count are refused for their value, and 43 that were refused return to main's bytes, 41 of them with main's bytes exactly (lone sYCC, e-sRGB, ROMM-RGB, e-sYCC, CIELab and 19 ICC inputs whose channels do not fit but whose name does, two lone-sYCCcdefinputs, and the twocdefinputs whose entry names a channel the image lacks) and 2 lone-sYCC inputs with an out-of-rangecdefentry that now write noColorSpacelike the other lone files that fit. Main's bytes are kept for 1,695 - 821 = 874 of the earlier inputs.Colour-channel reading,
colrallowance and depth: measured against main (headb606e47)Probe of 1,988 inputs (the 1,866 of the previous round plus 122 new: repeated type 0 entries, a
cdefbox that leaves a channel undescribed, extra entries beside a usable box, vendor and reserved methods, two-box sets, short boxes, depth 38 and 39 and more frombpcc,ihdr, a bare codestream and a file with nojp2horihdr, at 1, 3 and 4 channels), 14,217 saves per side. Main2d587c2against headb606e47, the resolvedVellumPdf.Kernel.dllandVellumPdf.Layout.dllprinted by the probe for each: 963 inputs identical on every save, 708 refused, 205 with other bytes and no refusal, 112 with only a changed diagnostic list. No input goes from refused on main to saved. Over the previous 1,866 inputs alone: 924 identical, 650 refused, 202 other bytes, 90 diagnostics only; main2d587c2equals main1b53e4fon all of them. Against the previous head7e6f6c7, 13 inputs that were refused return to main's bytes (the niner8inputs with an extra type 0 entry beside an opacity channel, and four with an empty or all-colour-repeated box), 10 lone vendor or reserved methods, 6 two-box sets and 7 depths over 38 bits that were written are refused, 3r8no-colrfiles with an extra entry change fromDeviceCMYKover three colour channels to a refusal, 6 lone sYCC or ICC files with an extra entry lose thatDeviceCMYK(noColorSpace, three colour channels), and acdefbox that leaves a channel undescribed has two counts and keeps main's bytes when the name fits either (r4:cdef-incomplete-rgb4,r4:cmap-3of4-srgb-cdef,r9:undescribed-rgb4-ch3,r9:undescribed-grey2,r9:undescribed-depth49-rgb3), and is refused only when it fits neither (r7:cdef-oor-gray1-opacity,r7:cdef-rgb-c5-oor3,r9:undescribed-rgb4-ch1).Readings of an incomplete
cdefbox: measured against main (head4e18f54)Probe of 2,032 inputs (the 1,988 of the previous round plus the 44
r10inputs of the last review), 14,525 saves per side. Main2d587c2against head4e18f54, the resolvedVellumPdf.Kernel.dllandVellumPdf.Layout.dllprinted by the probe for each: 976 inputs identical on every save, 730 refused, 212 with other bytes and no refusal, 114 with only a changed diagnostic list. No input goes from refused on main to saved. Against the previous headb606e47, 6 inputs that kept main's bytes (or, for one lone sYCC input, wrote noColorSpace) are refused:r9:undescribed-depth49-rgb3,r10:d1-undescribed-ch2-bpcc39-rgb3,r10:d1-undescribed-ch3-bpcc39-cmyk4,r10:d1-empty-cdef-ihdr39-rgb3,r10:d1-oor-only-ihdr39-grey1andr10:d1-undescribed-lone-sycc-bpcc39-c3; under every reading of theircdefbox, one of the name and the depth check fails. The controlr10:d1-undescribed-ch0-bpcc39-grey2(channel 0 undescribed and 39 bits deep, channel 1 named and 8 bits deep,DeviceGray) is written with main's bytes, and its 501 report for mixed depths is gone: the report is judged under the reading that is kept, here the one naming channel 1, which has one depth.r10:d3-bpcc4-nc3-last39and-cdef,r10:d1-undescribed-ch2-bpcc39-all-rgb3andr10:d1-oor-ch2-ihdr39-rgb3were refused atb606e47and still are, with a different message.Tests
The audit's skipped tests for these issues lose their skip, their pins of the old output are rewritten as the new outputs, and tests are added for the kept side of each rule (kept JPEG frames, kept
colrcombinations,Rsizwith bit 15 alone, with each of bits 2, 3, 8 and 9, and with bits 14 and 15 clear (0, 1, 2, 0xFFF, 0x3FFF), each required bit refused, bit 14 refused, two-box and one-box JP2 files under veraPDF, the channel-count andcdefrows above, a palette,cmapalone, a lone vendor or shortcolr, a band logo, the message without alternative text, APPROX counts, depth-only and colour-only comparison, opaque associated alpha, 16-bit Matte, a colour above its alpha).Release, head
8783099(merged with main2d587c2, which adds Layout tests to the Layout count). Build 0 warnings,dotnet format --verify-no-changes, the clean-room check,generate-roadmap.py --checkandgenerate-pdf20-inventory.py --checkpass. Oracles on (REQUIRE_ORACLES=1, veraPDF 1.30.4, qpdf 12.4.2, poppler).Mutations
Each fix undone in the worktree, Kernel.Tests rebuilt in Release, the 150 JPX tests run (net10.0), each tree restored after. "Cases" counts theory cases.
cdefcount ignoredcdefchannel refusal removedcmapalone a palettejp2hrefusal deletedcdefbox readRsizbit not checked 4;colrignored 9; noMatte3; JPEG component count, precision, frame type 4, 5, 10; bare codestream count 3; CIEJab-only not refused 1; ICC leavesColorSpace2; band-logo report removed 1; alternative text quoted 1Mutations, the
RsizruleEach mutant applied to
JpxImageLoader.cs, Kernel.Tests rebuilt in Release, the 96 tests whose names contain7_4_9_run (net10.0), the tree restored after. Every mutant failed at least one test.Mutations, lone
colrbox,cdefcounting and depthsEach mutant applied to
JpxImageLoader.cs, Kernel.Tests rebuilt in Release, theConformanceAuditG4TestsandJpxImageTestsclasses run (net10.0), the tree restored after. The runner printed at most the first 14 failing cases; counts are of those lines.colrbox not compared with the colour channelscdefcount not distinctcdefcount not limited to channels below the channel countRsizbits 12 and 13 refusedcmapnot remappedjpxbbrand ignoredjp2hbpccor codestream droppedihdrdroppedjplhnote dropped from the messagecdefbox stops the searchcmaphint droppedRsizcheck removed from the SIZ parseMutations, readings of an incomplete
cdefbox (head4e18f54)Each mutant applied to
JpxImageLoader.csin a detached worktree at6b76247, Kernel.Tests rebuilt in Release (net10.0), theConformanceAuditG4TestsandJpxImageTestsclasses (668 tests, baseline 0 failed) run, the tree restored after (git status --short srcempty each time). The count is the runner'sFailedtotal.bpccentry past the last channel not refusedDeviceCMYKonly under the every-channel readingMutations, colour-channel reading, allowed
colrboxes and depth (headb606e47)Each mutant applied to
JpxImageLoader.csin a detached worktree, Kernel.Tests rebuilt in Release (net10.0), theConformanceAuditG4TestsandJpxImageTestsclasses (651 tests, baseline 0 failed) run, the tree restored after (git status --short srcempty each time).cdefbox still usedTake(channels))ihdrnot readMutations, the lone
colrbox and thecdefcount (previous round)Each mutant applied to
JpxImageLoader.cs, Kernel.Tests rebuilt in Release (net10.0), the 261 tests whose names contain7_4_9_or that are inJpxImageTestsrun, the tree restored after (git status --short srcempty each time).ihdrheight or width not sent to the SIZ parse (only both zero)HSVwithout a component countcdefcount not capped at the channel countcdefcount only of channels below the channel countcdefcount not distinctNot done
A JP2 file with no
colrbox is not refused, and neither is one whose onlycolrboxes are too short to read (under 3 bytes, or method 1 under 7). ISO 32000-2, 7.4.9, and ISO/IEC 15444-2:2004, M.9.2.4, would arguably cover them; the refusal covers the other classes only.A method 2 or 3
colrbox counts as an ICC profile whatever its profile bytes hold. Whether an unreadable profile is allowed under ISO/IEC 15444-2:2004, M.9.2.4, "restricted ICC" and "any ICC", is open.A �pcc box with more entries than the image has channels is refused only when an entry past the last channel is deeper than 38 bits. One with shallow extra entries is written, though it is not conforming either (15444-1 I.5.3.2, from the NEN notes); refusing it would be a new refusal, so it is proposed, not done.
A refusal of the PDF/A-only JP2 inputs at the Kernel loader: they are reported by the Layout save instead.
A report from a Kernel-only document or from an image a custom renderer registers itself.
ImageDecodeMode.DecodeToRasterand Orientation (Kernel: TiffImageLoader reads Orientation and does not apply it #769) are untouched.A palette file's colour channels, the ICC profile's conformance and bit depths of a palette are not read.
The limits the baseline puts on the multiple component transformation (
Qmcc1, array-basedXmcc, irreversibleTmcc,Nmco1 in the MCC and MCO marker segments, 15444-2:2004 M.9.2.3) are not checked, so a codestream with bit 8 set and a transformation beyond them passes. A separate follow-up issue is to cover that check. Bits 12 and 13, which Table A.2 leaves reserved, are not examined.A JP2 file with exactly one non-device
colrbox whose space its channels fit loses its/ColorSpacename; 2.3.3 wrote a valid file for it, and the change is Kernel: the JPEG and JPEG 2000 loaders write a device colour space from the component count, and pass on frames that DCTDecode does not decode #763's fix, listed in the CHANGELOG entry.Where a device name other than the one the channel count chooses would have as many components as the colour channels (for example one sYCC box over four channels whose
cdefmarks one colour channel, whereDeviceGraywould fit), the file is refused, as it is for a device colour box; the loader does not look for another name.