Commit Graph

206 Commits

Author SHA1 Message Date
Nico Weber
b45a4508c7 LibGfx/JBIG2: Implement support for context templates 1, 2, and 3
Template 2 is needed by some symbols in 0000372.pdf page 11 and
0000857.pdf pages 1-4. Implement the others too while here.  (The
mentioned pages in those two PDFs also use the "end of stripe" segment,
so they still don't render yet.

We still don't support EXTTEMPLATE.
2024-03-25 14:08:40 +01:00
Nico Weber
e2f02f4df7 Tests/JBIG2: Add test images for non-0 templates
Produced by this shell script:

```sh
S=Tests/LibGfx/test-inputs/bmp/bitmap.bmp
J=$HOME/Downloads/T-REC-T.88-201808-I\!\!SOFT-ZST-E/Software
J=$J/JBIG2_SampleSoftware-A20180829/source/jbig2

for t in template1 template1-tpgdon \
         template2 template2-tpgdon \
         template3 template3-tpgdon; do
  echo $t.ini
  cat $t.ini
  echo
  $J -i "${S%.bmp}" -f bmp -o bitmap-$t -F jb2 -ini $t.ini
  echo
done
```

Producing this output:

```sh
% ./make-templates.sh
template1.ini
-Gen -Seg 1
-Gen -Param -Template 1
-Gen -Param -ATX1 3
-Gen -Param -ATY1 -1

ENC Start ===>complete

template1-tpgdon.ini
-Gen -Seg 1
-Gen -Param -Template 1
-Gen -Param -ATX1 3
-Gen -Param -ATY1 -1
-Gen -Param -TpGDon 1

ENC Start ===>complete

template2.ini
-Gen -Seg 1
-Gen -Param -Template 2
-Gen -Param -TpGDon 1
-Gen -Param -ATX1 2
-Gen -Param -ATY1 -1

ENC Start ===>complete

template2-tpgdon.ini
-Gen -Seg 1
-Gen -Param -Template 2
-Gen -Param -ATX1 2
-Gen -Param -ATY1 -1
-Gen -Param -TpGDon 1

ENC Start ===>complete

template3.ini
-Gen -Seg 1
-Gen -Param -Template 3
-Gen -Param -ATX1 2
-Gen -Param -ATY1 -1

ENC Start ===>complete

template3-tpgdon.ini
-Gen -Seg 1
-Gen -Param -Template 3
-Gen -Param -ATX1 2
-Gen -Param -ATY1 -1
-Gen -Param -TpGDon 1

ENC Start ===>complete
```

`jbig2` still has the local patch mentioned in #23608 to make it write
correct TPGDON data.
2024-03-25 14:08:40 +01:00
Nico Weber
259a84ddac Tests/JBIG2: Add a test for symbol and text segment decoding 2024-03-23 17:30:15 -04:00
Nico Weber
3454970903 LibGfx/JBIG2: Extract composite_bitbuffer() and add some features
This extracts the bitbuffer combining code we had into a new function
composite_bitbuffer() and adds the following features:

* Real support for combination operators (which also lets us allow black
  as background color again, even if that's never used in practice)
* Clipping support (not used here yet, but will be needed elsewhere
  soon)

We're going to need this for text segment handling.

No behavior change.
2024-03-23 17:30:15 -04:00
Nico Weber
3a50cadddf Tests/LibGfx: Add a jbig2 file using basic symbol and text segments
I created this file using `jbig2` (see below for details), but as
far as I can tell `jbig2` does not produce spec-compliant files:

1. It always writes to 0s for the run lengths that specify how
   many symbols to export at the end of a symbol segment

2. It doesn't write any referred-to segments for text segments.
   I think it's supposed to write a referred-to segment that
   mentions the symbol segment the text segment refers to (?)

I locally tweaked `jbig2` to fix these two defects (*), so the image
added in this commit is correct as best I can tell. It opens fine
using `image` and `jbig2`'s decode mode, and via
`Meta/jbig2_to_pdf.py` in Firefox and Chrome. Without my tweaks,
the image decodes fine with `jbig2`, but not with any of the other
three. The image (in a pdf) does _not_ decode in Preview.app,
either with or without my local `jbig2` tweaks.

*: See the PR adding this image for my local diff.

I created the test image file by running this shell script with
`jbig2` tweaked as described above:

    #!/bin/bash
    set -eu

    I=Build/lagom/bin/image
    S=Tests/LibGfx/test-inputs/bmp/bitmap.bmp

    $I "$S" --crop 232,70,120,250  -o mouth.bmp
    $I "$S" --crop 135,100,100,100 -o nose.bmp
    $I "$S" --crop 50,108,30,30    -o top_eye.bmp
    $I "$S" --crop 60,265,30,30    -o bottom_eye.bmp

    # I then manually converted those to 1bpp using Photoshop
    # (Image->Mode->Grayscale, then Image->Mode->Bitmap...,
    # File->Save As..., bmp) since `jbig2` gets confused by non-1bpp
    # bmp files and `image` can't write 1bpp files :/
    #
    # (I tried `convert ${in} -monochrome ${in}-1bpp.bmp` via
    # https://cancerberosgx.github.io/magic/playground/index.html
    # first, but that produced bmp files that neither Preview.app nor
    # `jbig2` could handle.)
    #
    # -HeightClass: Number of height classes
    # -WidthClass: Maximum number of symbols in one height class
    # -Simple means no refinement; the number after is the symbol's ID
    # The 3 numbers afer `-ID` are id, y, x. The `-ID` are sorted by x.
    # -RefCorner 1 means "top left".
    #
    # `jbig2` writes symbol and text segments as specified in the ini
    # file, and then only stores the bits of the input image that aren't
    # already set through symbol and text segments.

    cat << EOF > jbig2-symbol.ini
    -sym -Seg 1
    -sym -file -numClass -HeightClass 3 -WidthClass 2
    -sym -file -numSymbol 4
    -sym -file -Height 250
    -sym -file -Width 120 -Simple 0 mouth-1bpp.bmp
    -sym -file -EndOfHeightClass
    -sym -file -Height 100
    -sym -file -Width 100 -Simple 1 nose-1bpp.bmp
    -sym -file -EndOfHeightClass
    -sym -file -Height 30
    -sym -file -Width 30 -Simple 2 top_eye-1bpp.bmp
    -sym -file -Width 30 -Simple 3 bottom_eye-1bpp.bmp
    -sym -file -EndOfHeightClass
    -sym -Param -Huff_DH 0
    -sym -Param -Huff_DW 0

    -txt -Seg 2
    -txt -Param -numInst 4
        -ID 2 108 50 -ID 3 265 60 -ID 1 100 135 -ID 0 70 232
    -txt -Param -RefCorner 1
    -txt -Param -Xlocation 0
    -txt -Param -Ylocation 0
    -txt -Param -W 399
    -txt -Param -H 400
    EOF

    J=$HOME/Downloads/T-REC-T.88-201808-I\!\!SOFT-ZST-E/Software
    J=$J/JBIG2_SampleSoftware-A20180829/source/jbig2

    $J -i "${S%.bmp}" -f bmp -o symbol -F jb2 -ini jbig2-symbol.ini
2024-03-23 08:18:15 -04:00
Nico Weber
576bc0e55b Tests/LibGfx: Consolidate jbig2 decode tests
Removes some duplication, and makes it easier to add additional tests.
No behavior change.
2024-03-22 11:29:27 +01:00
Nico Weber
4329983cde Tests/LibGfx: Fix a small typo in the jbig2 decode tests
Instead of comparing to a reference bmp file, we accidentally were
comparing the file against itself. Luckily, after fixing this, things
still pass.
2024-03-22 11:29:27 +01:00
Nico Weber
7650e657aa LibGfx/JBIG2: Implement support for TPGDON 2024-03-17 17:38:30 +01:00
Nico Weber
edec2b9baa Tests/LibGfx: Add a test jbig2 file using TPGDON
"TPGD" is short for "Typical Prediction for Generic Direct coding",
and the "ON" bit turns it on. In this mode, before decoding a line,
we decode a single bit first that controls if the current line is
just a copy of the previous line. If so, the line's pixels aren't
encoded, the decoder just copies the previous line.

I created this by running

    jbig2 -i Tests/LibGfx/test-inputs/bmp/bitmap -f bmp \
        -o bitmap -F jb2 -ini tpgdon.ini

where tpgdon.ini contained:

    -Gen -Seg 1
    -Gen -Param -TpGDon 1

See previous commits in this directory for details on the `jbig2` tool.

Sadly, the TPGDON writing path in `jbig2` wasn't implemented yet,
so I had to add this. See the PR that added this commit for my
local diff to `jbig2`.

I'm somewhat confident that my change to `jbig2` (and hence the
image added in this commit) is correct because:

1. `jbig2` succeeds in converting this file to a bmp file,
   while it failed without my patch (the decoding codepath in
   `jbig2` does have TPGDON support)

2. Other pdf viewers display the output of
   `Meta/jbig2_to_pdf.py -o foo.pdf path/to/bitmap-tpgdon.jbig2 399 400`
   the same way we do
2024-03-17 17:38:30 +01:00
Nico Weber
f391c7822d LibGfx/JBIG2: Call decode_immediate_generic_region for lossless regions
It seems to do the right thing already, and nothing in the spec says
not to do this as far as I can tell.

With this, we can finally decode
Tests/LibGfx/test-inputs/jbig2/bitmap.jbig2 and add a test for
decoding simple arithmetic-coded images.
2024-03-16 09:21:42 -04:00
Nico Weber
b0c73d1652 LibGfx/JBIG2: Reject unimplemented combination operators
In practice, everything uses white backgrounds and operators `or`
or `xor` to turn them black, at least for the simple images we're
about to be able to decode.

To make sure we don't forget implementing this for real once needed,
reject other ops, and also reject black backgrounds (because 1 | 0
is 1, not 0 like our overwrite implementation will produce).

This means we have to remove a test, but since this scenario doesn't
seem to happen in practice, that seems ok.
2024-03-16 09:21:42 -04:00
Nico Weber
b8f80501ec LibGfx/JBIG2: Pass Context to get_next_bit() instead of to initialize()
The context can vary for every bit we read.

This does not affect the one use in the test which reuses the same
context for all bits, but it is necessary for future changes.
2024-03-16 09:21:42 -04:00
Nico Weber
df9dd8ec69 LibGfx/JBIG2: Add arithmetic coding decoder
I think the context normally changes for every bit. But this here
is enough to correctly decode the test bitstream in Annex H.2 in
the spec, which seems like a good checkpoint.

The internals of the decoder use spec naming, to make the code
look virtually identical to what's in the spec. (Even so, I managed
to put in several typos that took a while to track down.)
2024-03-14 18:18:15 -06:00
Nico Weber
77850f06dc Tests: Remove logspam from TestPainter 2024-03-14 10:56:13 -04:00
MacDue
4c15c87d0c LibGfx/TinyVG: Fix decoding green channel of graphics RGB565 colors
The division was missed here, so this would produce overly bright greens
(or overflow).
2024-03-12 21:53:23 +00:00
Nico Weber
bdbc21c52d LibGfx/JBIG2: Implement conversion to Gfx::Bitmap and ByteBuffer
With this, `image` can convert any jbig2 file, as long as it's
black (or white), and LibPDF can draw jbig2 files (again, as long
as they only contain a single color stored in just a
PageInformation segment).
2024-03-10 10:10:55 -04:00
Nico Weber
54dcb17062 Tests/LibGfx: Add two more test jbig2 files
I extracted a pure-white jbig2 that has only a PageInformation segment
from a PDF and manually edited the bytes to reduce the bitmap size to
47x23 and to clear all unneded bits (except, in the black version,
the page color bit is set).
2024-03-10 10:10:55 -04:00
Nico Weber
8f4930f2df LibGfx/JBIG2: Scan for the first PageInformation segment and decode it
This allows `file` to correctly print the dimensions of a .jbig2 file,
and it allows us to write a test that covers much of all the code
written so far.
2024-03-09 16:01:22 +01:00
Nico Weber
bd60d1db7e Tests/LibGfx: Add a simple test jbig2 file
I created this by running

    jbig2 -i Tests/LibGfx/test-inputs/bmp/bitmap -f bmp -o bitmap -F jb2

using the `jbig2` tool whose source code is in the zip file here:
https://www.itu.int/rec/T-REC-T.88-201808-I

(Just `make jbig2` in Software/JBIG2_SampleSoftware-A20180829/source
was enough to build it.)

As far as I can tell (cf `JBIG2_EncMain()` which always writes `1`
to the flags byte in the file header), this tool always writes files
in the sequential organization.
2024-03-09 16:01:22 +01:00
Nico Weber
6607757b08 LibGfx: Make validate_before_create() create a regular bool
This is for validating that a decoder with a weak or nonexistent
sniff() method thinks it can decode an image. This should not be
treated as an error.

No behavior change.
2024-03-08 08:38:31 +01:00
Nico Weber
ab143e9b0e LibGfx/BMP: Clear alpha in palette entries
The semantics of BGRx8888 aren't super clear and it means different
things for different parts of the codebase. In particular, the PNG
writer still writes the x channel to the alpha channel of its output.

In BMPs, the 4th palette byte is usually 0, which means after #21412 we
started writing all .bmp files with <= 8bpp as completely transparent
to PNGs.

This works around that.

(See also #19464 for previous similar workarounds.)

The added `bitmap.bmp` is a 1bpp file I drew in Photoshop and saved
using its "Save as..." saving path.
2024-03-05 21:27:41 +00:00
Lucas CHOLLET
9ec3480207 LibGfx/TIFF: Add support for Group4Fax encoded images
Note that we don't parse the T6 option group yet.

The test case was generated with GIMP.
2024-02-21 13:49:43 +01:00
Lucas CHOLLET
be9ec591e7 LibGfx/CCITT: Add support for Group3 2D
The two test images were created with:
tiffcp ccit3.tiff -c g3:2d ccit3_2d.tiff
tiffcp ccit3.tiff -c g3:2d:fill ccit3_2d_fill.tiff
2024-02-19 01:40:04 +01:00
Tim Ledbetter
3ffa2a39bc Tests: Propagate errors with TRY_OR_FAIL() where possible 2024-02-14 17:46:06 -05:00
Lucas CHOLLET
8e21bbf7bf LibGfx/TIFF: Add support for tiled images
A tile is basically a strip with a user-defined width. With that in
mind, adding support for them is quite straightforward. As a lot the
common code was named after 'strips', to avoid future confusion I
renamed everything that interact with either strips or tiles to a
global term: 'segment'.

Note that tiled images are supposed to always have a 'TileOffsets' tag
instead of 'StripOffset'. However, this doesn't seem to be enforced by
encoders, so we support having either of them indifferently.

The test case was generated with the following Python script:

import pyvips

img = pyvips.Image.new_from_file('deflate.tiff')
img.write_to_file('tiled.tiff',
                  compression=pyvips.ForeignTiffCompression.DEFLATE,
                  tile=True, tile_width=64, tile_height=64)
2024-02-13 10:13:11 +01:00
Lucas CHOLLET
b9afac0a06 LibGfx/CCITT: Consider the UseFillBits option 2024-02-12 14:08:56 +01:00
Nico Weber
69964e10f4 LibGfx+Tests: Improve calculation of restart interval
JPEGs can store a `restart_interval`, which controls how many
minimum coded units (MCUs) apart the stream state resets.
This can be used for error correction, decoding parts of a jpeg
in parallel, etc.

We tried to use

    u32 i = vcursor * context.mblock_meta.hpadded_count + hcursor;
    i % (context.dc_restart_interval *
         context.sampling_factors.vertical *
         context.sampling_factors.horizontal) == 0

to check if we hit a multiple of an MCU.

`hcursor` is the horizontal offset into 8x8 blocks, vcursor the
vertical offset, and hpadded_count stores how many 8x8 blocks
we have per row, padded to a multiple of the sampling factor.

This isn't quite right if hcursor isn't divisible by both
the vertical and horizontal sampling factor. Tweak things so
that they work.

Also rename `i` to `number_of_mcus_decoded_so_far` since that
what it is, at least now.

For the test case, I converted an existing image to a ppm:

    Build/lagom/bin/image -o out.ppm \
        Tests/LibGfx/test-inputs/jpg/12-bit.jpg

Then I resized it to 102x77px in Photoshop and saved it again.
Then I turned it into a jpeg like so:

    path/to/cjpeg \
        -outfile Tests/LibGfx/test-inputs/jpg/odd-restart.jpg \
        -sample 2x2,1x1,1x1 -quality 5 -restart 3B out.ppm

The trick here is to:

a) Pick a size that's not divisible by the data size width (8),
   and that when rounded to a block size (13) still isn't divisible
   by the subsample factor -- done by picking a width of 102.
b) Pick a huffman table that doesn't happen to contain the bit
   pattern for a restart marker, so that reading a restart marker
   from the bitstream as data causes a failure (-quality 5 happens
   to do this)
c) Pick a restart interval where we fail to skip it if our calculation
   is off (-restart 3B)

Together with #22987, fixes #22780.
2024-01-30 14:50:43 +01:00
Nico Weber
6971ba35d5 LibGfx+Tests: Support grayscale jpegs with 2x2 sampling and MCU reset
Non-interleaved files always have an MCU of one data unit.

(A "data unit" is an 8x8 tile of pixels, and an "MCU" is a
"minium coded unit", e.g. 2x2 data units for luminance and
1 data unit each for Cr and Cb for a YCrCb image with
4:2:0 subsampling.)

For the test case, I converted an existing image to a ppm:

    Build/lagom/bin/image -o out.ppm \
        Tests/LibGfx/test-inputs/jpg/12-bit.jpg

Then I converted it to grayscale and saved it as a pgm in Photoshop.
Then I turned it into a weird jpeg like so:

    path/to/cjpeg \
        -outfile Tests/LibGfx/test-inputs/jpg/grayscale_mcu.jpg \
        -sample 2x2 -restart 3 out.pgm

Makes 3 of the 5 jpegs failing to decode at #22780 go.
2024-01-30 05:35:22 +01:00
Nico Weber
c694d4326b Tests: Add a pam cmyk test file
Hand-written in a text editor.

I verified that `convert` converts it to a png that looks like the
rgb test expectations.
2024-01-26 07:36:53 +01:00
Nico Weber
ba8f4e73bf Tests: Add a pam test file
Hand-written in a text editor.

I verified that `convert` converts it to a png that looks like the
test expectations.
2024-01-26 07:36:53 +01:00
Nico Weber
550937f5dd Tests: Add a test cmyk jpeg file with an embedded color profile
I opened Base/res/graphics/buggie.png in Photoshop, converted it
to U.S. Web Coated (SWOP) v2, flattened the image so we don't have
CMYK with alpha, and saved it as a jpeg (with color profile embedded).
2024-01-25 15:53:44 +01:00
Lucas CHOLLET
a17041fe7f LibGfx/TIFF: Add support for CMYK
The test case has been generated with Krita.
2024-01-24 22:16:22 -07:00
Lucas CHOLLET
1faf9bb44f LibGfx/TIFF: Apply the HorizontalDifferencing on the alpha channel
When present, the alpha channel is also affected by the horizontal
differencing predictor.

The test case was generated with GIMP with the following steps:
 - Open an RGB image
 - Add a transparency layer
 - Export as TIFF with the LZW compression scheme
2024-01-22 20:10:48 -07:00
Lucas CHOLLET
c2c7365494 LibGfx/TIFF: Accept images with a single strip and no RowsPerStrip tag
This tag is required by the specification, but some encoders (at least
Krita) don't write it for images with a single strip.

The test file was generated by opening deflate.tiff in Krita and saving
it with the DEFLATE compression.
2024-01-19 14:13:44 +01:00
Lucas CHOLLET
75d87ccf5f LibGfx/TIFF+CCITT: Start to decode CCITT Group 3 images
We currently only support 1D Group 3, but that's a start.

The test case was generated with GIMP (it happens to be 1D by chance).
2024-01-18 14:00:56 +01:00
Lucas CHOLLET
edffdc35a9 LibGfx/TIFF+CCITT: Clarify naming of compression type 2
Type 2 <=> One-dimensional Group3, customized for TIFF
Type 3 <=> Two-dimensional Group3, uses the original 1D internally
Type 4 <=> Two-dimensional Group4

So let's clarify that this is not Group3 1D but the TIFF variant, which
is called `CCITTRLE` in libtiff. So let's stick with this name to avoid
confusion.
2024-01-18 14:00:56 +01:00
Nicolas Ramz
534eeb6c4b LibGfx/ILBMLoader: Properly display images with a bitplane mask
Images with a display mask ("stencil" as it's called in DPaint) add
an extra bitplane which acts as a mask. For now, at least skip it
properly. Later we should render masked pixels as transparent, but
this requires some refactoring.
2024-01-18 13:59:17 +01:00
Lucas CHOLLET
015c47da51 Tests/LibGfx: Use TRY_OR_FAIL more in TestImageDecoder 2024-01-15 23:16:57 -07:00
Nico Weber
3616d14c80 LibGfx/JPEG: Allow decoding more subsampling factors
We now allow all subsampling factors where the subsampling factors
of follow-on components evenly decode the ones of the first component.

In practice, this allows YCCK 2111, CMYK 2112, and CMYK 2111.
2024-01-15 11:20:11 -07:00
Nicolas Ramz
a1255cb6c9 LibGfx/ILBMLoader: Don't decode bits once full row has been decoded
We were potentially decoding more bits than needed: this could
trash the next lines if decoder didn't zero the extra bits.
2024-01-14 20:41:25 +01:00
Nico Weber
1b4f9bdbdb Tests: Add a png in Display P3 that shows up as solid color in sRGB
I created a 16-bpp RGB file in Display P3 in photoshop, filled it
with (0, 255, 0), and then drew something on it with (100, 255, 0).

(Since it's a 16-bpp image, 255 ix stored as 0xffff and 100 is stored
as 65535 * 100 / 255 == 0x6464 in the file.)

I verified that Edit->Convert to Profile...->sRGB resulted in an
image filled with (0, 255, 0) in that color space (due to gamut
clipping).

Similar to these:
* https://webkit.org/blog-files/color-gamut/Webkit-logo-P3.png
* https://www.dropbox.com/s/tgarynpj65ouafd/insta-logo.png?dl=1

...but in green instead of in red, and hand-drawn by me so no license
concerns.
2024-01-12 16:20:46 -07:00
Nico Weber
7fb32b6682 LibGfx: Fix off-by-some in Painter::draw_scaled_bitmap_with_transform()
Before this, drawing a 1x1 bitmap scaled up to MxN would only fill
M/2 x N/2 pixel, due to source_point going outside (0, 0).
2024-01-10 09:38:13 +01:00
Nicolas Ramz
fc5b6e4dda LiGfx/ILBMLoader: Don't throw if malformed bitplane can be decoded
Some apps seem to generate malformed images that are accepted
by most readers. We now only throw if malformed data would lead to
a write outside the chunky buffer.
2024-01-08 07:21:27 -07:00
Lucas CHOLLET
335097e446 LibGfx/TIFF: Modify the image according to the Orientation tag
Let's use the already existing logic (ExifOrientedBitmap) to modify the
bitmap to honor the orientation tag.
2024-01-08 00:07:44 +01:00
Lucas CHOLLET
402de2985d LibGfx/ICO: Do not try to decode a mask if we already reached EOF
When using the BMP encoding, ICO images are expected to contain a 1-bit
mask for transparency. Regardless an alpha channel is already included
in the image, the mask is always required. As stated here[1], the
mask is used to provide shadow around the image.

Unfortunately, it seems that some encoder do not include that second
transparency mask. So let's read that mask only if some data is still
remaining after decoding the image.

The test case has been generated by truncating the 64 last bytes
(originally dedicated to the mask) from the `serenity.ico` file and
changing the declared size of the image in the ICO header. The size
value is stored at the offset 0x0E in the file and I changed the value
from 0x0468 to 0x0428.

[1]: https://devblogs.microsoft.com/oldnewthing/20101021-00/?p=12483
2024-01-07 12:32:02 -05:00
Lucas CHOLLET
9c54c13744 Tests/LibGfx: Move the ICO test file to the ico directory
And add more tests on the image than just "we are able to decode it".
2024-01-07 12:32:02 -05:00
Lucas CHOLLET
75fc51bb67 Tests/LibGfx: Fix a typo 2024-01-07 10:22:59 +01:00
Andreas Kling
182a2b0c3a LibGfx/GIF: Only parse global color table if header flag is set
This fixes an issue where GIF images without a global color table would
have the first segment incorrectly interpreted as color table data.

Makes many more screenshots appear on https://virtuallyfun.com/ :^)
2024-01-05 13:20:00 +01:00
Lucas CHOLLET
b8cbc282f3 LibGfx/TIFF: Don't stop decoding when failing to decode a tag
TIFF files are made in a way that make them easily extendable and over
the years people have made sure to exploit that. In other words, it's
easy to find images with non-standard tags. Instead of returning an
error for that, let's skip them.

Note that we need to make sure to realign the reading head in the file.

The test case was originally a 10x10 checkerboard image with required
tags, and also the `DocumentName` tag. Then, I modified this tag in a
hexadecimal editor and replaced its id with 30 000 (0x3075 as a LE u16)
and the type with the same value as well. This is AFAIK, never used as
a custom TIFF tag, so this should remain an invalid tag id and type.
2024-01-04 14:27:16 +01:00
Lucas CHOLLET
73c8b4865e LibGfx/TIFF: Add AdobeDeflate compression support
This new compression is quite popular and uses a basic Zlib compression
to compress strips. Note that this is not part of the original TIFF
specification but in the Technical Notes from 2002:
https://web.archive.org/web/20160305055905/http://partners.adobe.com/public/developer/en/tiff/TIFFphotoshop.pdf

The test case was generated with GIMP.
2023-12-29 20:12:07 +01:00