dmnisson: seems to break other TIFF decoding, please don't merge yet
dmnisson: Some of the tests might still fail because they still expect the old tile descriptors.
radarhere: Your first commit includes unrelated raqm-cmake files. Would you be able to remove those?
hugovk: We should probably do a rebase or squash and merge to remove the addition and removal commits.

![image](https://user-images.githubusercontent.com/1324225/56296005-5a24cc00-6136-11e9-97fb-540a676cbe82.png)

radarhere: I've rebased and moved the addition and removal of the extra files.
diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py
index 7596aae65..835c460a5 100644
--- a/src/PIL/TiffImagePlugin.py
+++ b/src/PIL/TiffImagePlugin.py
@@ -1121,7 +1121,7 @@ class TiffImageFile(ImageFile.ImageFile):
         # (self._compression, (extents tuple),
         #   0, (rawmode, self._compression, fp))
         extents = self.tile[0][1]
-        args = list(self.tile[0][3]) + [self.tag_v2.offset]
+        args = list(self.tile[0][3])
 
         # To be nice on memory footprint, if there's a
         # file descriptor, use that instead of reading
@@ -1328,8 +1328,8 @@ class TiffImageFile(ImageFile.ImageFile):
 
             # Offset in the tile tuple is 0, we go from 0,0 to
             # w,h, and we only do this once -- eds
-            a = (rawmode, self._compression, False)
-            self.tile.append((self._compression, (0, 0, xsize, ysize), 0, a))
+            a = (rawmode, self._compression, False, self.tag_v2.offset)
+            self.tile.append(("libtiff", (0, 0, xsize, ysize), 0, a))
 
         elif STRIPOFFSETS in self.tag_v2 or TILEOFFSETS in self.tag_v2:
             # striped image

AttributeError: module 'PIL._imaging' has no attribute 'group4_decoder'
### What did you do?

Executed this a script (code below) to get the dimensions of a tiff group4 image.

### What did you expect to happen?

I expected that the dimensions of the images would be printed

### What actually happened?

crash with the error

```
AttributeError: module 'PIL._imaging' has no attribute 'group4_decoder'
```

full output:

```
['DEFAULT_STRATEGY', 'FILTERED', 'FIXED', 'HAVE_LIBJPEGTURBO', 'HUFFMAN_ONLY', 'PILLOW_VERSION', 'RLE', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'alpha_composite', 'bcn_decoder', 'bit_decoder', 'blend', 'clear_cache', 'convert', 'draw', 'effect_mandelbrot', 'effect_noise', 'eps_encoder', 'fill', 'fli_decoder', 'font', 'get_alignment', 'get_block_size', 'get_blocks_max', 'get_stats', 'getcodecstatus', 'gif_decoder', 'gif_encoder', 'hex_decoder', 'hex_encoder', 'jp2klib_version', 'jpeg2k_decoder', 'jpeg2k_encoder', 'jpeg_decoder', 'jpeg_encoder', 'jpeglib_version', 'libtiff_decoder', 'libtiff_encoder', 'libtiff_version', 'linear_gradient', 'map_buffer', 'merge', 'new', 'outline', 'packbits_decoder', 'path', 'pcd_decoder', 'pcx_decoder', 'pcx_encoder', 'radial_gradient', 'raw_decoder', 'raw_encoder', 'reset_stats', 'set_alignment', 'set_block_size', 'set_blocks_max', 'sgi_rle_decoder', 'sun_rle_decoder', 'tga_rle_decoder', 'tga_rle_encoder', 'wedge', 'xbm_decoder', 'xbm_encoder', 'zip_decoder', 'zip_encoder', 'zlib_version']
5.4.1
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/PIL/Image.py", line 455, in _getdecoder
    decoder = getattr(core, decoder_name + "_decoder")
AttributeError: module 'PIL._imaging' has no attribute 'group4_decoder'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "bug.py", line 36, in <module>
    print(dimensionsFromBlobImage(blob))
  File "bug.py", line 24, in dimensionsFromBlobImage
    ImPar.feed(chunk)
  File "/usr/local/lib/python3.7/dist-packages/PIL/ImageFile.py", line 416, in feed
    im.mode, d, a, im.decoderconfig
  File "/usr/local/lib/python3.7/dist-packages/PIL/Image.py", line 458, in _getdecoder
    raise IOError("decoder %s not available" % decoder_name)
OSError: decoder group4 not available
```

### What are your OS, Python and Pillow versions?

* OS: Linux Debian (reproduced it on stable and sid)
* Python: 3.7.2+
* Pillow: 5.4.1

Note that I do have `libtiff5` and `libtiff5-dev` installed.

Here's the script:

```python
import PIL
from PIL import Image, TiffImagePlugin
from PIL import ImageFile

TiffImagePlugin.READ_LIBTIFF=True
print(dir(PIL._imaging))
print(PIL.PILLOW_VERSION)

def dimensionsFromBlobImage(blob):
    ImPar = ImageFile.Parser()
    chunk = blob.read(2048)
    while chunk != "":
        ImPar.feed(chunk)
        if ImPar.image:
            break
        chunk = blob.read(2048)
    return ImPar.image.size


with (open("I1GS1051890001.tif", mode='rb')) as blob:
    print(dimensionsFromBlobImage(blob))
```

and the image:

[I1GS1051890001.tif.zip](https://github.com/python-pillow/Pillow/files/3017275/I1GS1051890001.tif.zip)

Note that the script works fine when replacing the function with:

```python
def dimensionsFromBlobImage(blob):
    im = Image.open(blob)
    return im.size
```
diff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py
index dedcc179a..79955a5af 100644
--- a/Tests/test_file_libtiff.py
+++ b/Tests/test_file_libtiff.py
@@ -121,7 +121,7 @@ class TestFileLibTiff(LibTiffTestCase):
 
         self.assertEqual(im.mode, "RGB")
         self.assertEqual(im.size, (278, 374))
-        self.assertEqual(im.tile[0][:3], ("tiff_adobe_deflate", (0, 0, 278, 374), 0))
+        self.assertEqual(im.tile[0][:3], ("libtiff", (0, 0, 278, 374), 0))
         im.load()
 
         self.assert_image_equal_tofile(im, "Tests/images/tiff_adobe_deflate.png")
@@ -644,10 +644,10 @@ class TestFileLibTiff(LibTiffTestCase):
             im.tile,
             [
                 (
-                    "tiff_adobe_deflate",
+                    "libtiff",
                     (0, 0, 100, 40),
                     0,
-                    ("RGB;16N", "tiff_adobe_deflate", False),
+                    ("RGB;16N", "tiff_adobe_deflate", False, 8),
                 )
             ],
         )
@@ -661,7 +661,8 @@ class TestFileLibTiff(LibTiffTestCase):
         self.assertEqual(im.mode, "RGBA")
         self.assertEqual(im.size, (100, 40))
         self.assertEqual(
-            im.tile, [("tiff_lzw", (0, 0, 100, 40), 0, ("RGBa;16N", "tiff_lzw", False))]
+            im.tile,
+            [("libtiff", (0, 0, 100, 40), 0, ("RGBa;16N", "tiff_lzw", False, 38236))],
         )
         im.load()
 
@@ -680,7 +681,7 @@ class TestFileLibTiff(LibTiffTestCase):
         self.assertEqual(im.mode, "RGB")
         self.assertEqual(im.size, (256, 256))
         self.assertEqual(
-            im.tile, [("jpeg", (0, 0, 256, 256), 0, ("RGB", "jpeg", False))]
+            im.tile, [("libtiff", (0, 0, 256, 256), 0, ("RGB", "jpeg", False, 5122))]
         )
         im.load()
 

pip install -e .[dev]
parse_log_pytest
requirements.txt
apt-get update apt-get install -y gcc libjpeg-dev zlib1g-dev libtiff5-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev libharfbuzz-dev libfribidi-dev libxcb1-dev
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.16
babel==2.17.0
black==25.1.0
blessed==1.20.0
build==1.2.2.post1
certifi==2025.1.31
charset-normalizer==3.4.1
check-manifest==0.50
click==8.1.8
cov-core==1.15.0
coverage==7.8.0
coveralls==4.0.1
docopt==0.6.2
docutils==0.21.2
exceptiongroup==1.2.2
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
iniconfig==2.1.0
jarn.viewdoc==2.7
Jinja2==3.1.6
MarkupSafe==3.0.2
mypy-extensions==1.0.0
olefile==0.47
packaging==24.2
pathspec==0.12.1
-e git+https://github.com/python-pillow/Pillow.git@32d10505a30207a81bb9536d46bd12ec1e7b191f#egg=Pillow
platformdirs==4.3.7
pluggy==1.5.0
pycodestyle==2.13.0
pyflakes==3.3.1
Pygments==2.19.1
pyproject_hooks==1.2.0
pyroma==4.2
pytest==8.3.5
pytest-cov==6.0.0
pytz==2025.2
requests==2.32.3
six==1.17.0
snowballstemmer==2.2.0
Sphinx==7.4.7
sphinx-rtd-theme==3.0.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
tomli==2.2.1
trove-classifiers==2025.3.19.19
typing_extensions==4.13.0
urllib3==2.3.0
wcwidth==0.2.13
zipp==3.21.0

name: Pillow
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.16
      - babel==2.17.0
      - black==25.1.0
      - blessed==1.20.0
      - build==1.2.2.post1
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - check-manifest==0.50
      - click==8.1.8
      - cov-core==1.15.0
      - coverage==7.8.0
      - coveralls==4.0.1
      - docopt==0.6.2
      - docutils==0.21.2
      - exceptiongroup==1.2.2
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==8.6.1
      - iniconfig==2.1.0
      - jarn-viewdoc==2.7
      - jinja2==3.1.6
      - markupsafe==3.0.2
      - mypy-extensions==1.0.0
      - olefile==0.47
      - packaging==24.2
      - pathspec==0.12.1
      - platformdirs==4.3.7
      - pluggy==1.5.0
      - pycodestyle==2.13.0
      - pyflakes==3.3.1
      - pygments==2.19.1
      - pyproject-hooks==1.2.0
      - pyroma==4.2
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - pytz==2025.2
      - requests==2.32.3
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==7.4.7
      - sphinx-rtd-theme==3.0.2
      - sphinxcontrib-applehelp==2.0.0
      - sphinxcontrib-devhelp==2.0.0
      - sphinxcontrib-htmlhelp==2.1.0
      - sphinxcontrib-jquery==4.1
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==2.0.0
      - sphinxcontrib-serializinghtml==2.0.0
      - tomli==2.2.1
      - trove-classifiers==2025.3.19.19
      - typing-extensions==4.13.0
      - urllib3==2.3.0
      - wcwidth==0.2.13
      - zipp==3.21.0
prefix: /opt/conda/envs/Pillow

Tests/test_file_libtiff.py::TestFileLibTiff::test_16bit_RGB_tiff Tests/test_file_libtiff.py::TestFileLibTiff::test_16bit_RGBa_tiff Tests/test_file_libtiff.py::TestFileLibTiff::test_adobe_deflate_tiff Tests/test_file_libtiff.py::TestFileLibTiff::test_gimp_tiff
Tests/test_file_libtiff.py::TestFileLibTiff::test_custom_metadata
Tests/test_file_libtiff.py::TestFileLibTiff::test_12bit_rawmode Tests/test_file_libtiff.py::TestFileLibTiff::test_4bit Tests/test_file_libtiff.py::TestFileLibTiff::test__next Tests/test_file_libtiff.py::TestFileLibTiff::test_additional_metadata Tests/test_file_libtiff.py::TestFileLibTiff::test_big_endian Tests/test_file_libtiff.py::TestFileLibTiff::test_blur Tests/test_file_libtiff.py::TestFileLibTiff::test_cmyk_save Tests/test_file_libtiff.py::TestFileLibTiff::test_compressions Tests/test_file_libtiff.py::TestFileLibTiff::test_crashing_metadata Tests/test_file_libtiff.py::TestFileLibTiff::test_fd_duplication Tests/test_file_libtiff.py::TestFileLibTiff::test_fp_leak Tests/test_file_libtiff.py::TestFileLibTiff::test_g3_compression Tests/test_file_libtiff.py::TestFileLibTiff::test_g4_eq_png Tests/test_file_libtiff.py::TestFileLibTiff::test_g4_fillorder_eq_png Tests/test_file_libtiff.py::TestFileLibTiff::test_g4_large Tests/test_file_libtiff.py::TestFileLibTiff::test_g4_string_info Tests/test_file_libtiff.py::TestFileLibTiff::test_g4_tiff Tests/test_file_libtiff.py::TestFileLibTiff::test_g4_tiff_bytesio Tests/test_file_libtiff.py::TestFileLibTiff::test_g4_tiff_file Tests/test_file_libtiff.py::TestFileLibTiff::test_g4_write Tests/test_file_libtiff.py::TestFileLibTiff::test_gray_semibyte_per_pixel Tests/test_file_libtiff.py::TestFileLibTiff::test_int_dpi Tests/test_file_libtiff.py::TestFileLibTiff::test_little_endian Tests/test_file_libtiff.py::TestFileLibTiff::test_lzw Tests/test_file_libtiff.py::TestFileLibTiff::test_multipage Tests/test_file_libtiff.py::TestFileLibTiff::test_multipage_compression Tests/test_file_libtiff.py::TestFileLibTiff::test_multipage_nframes Tests/test_file_libtiff.py::TestFileLibTiff::test_old_style_jpeg Tests/test_file_libtiff.py::TestFileLibTiff::test_page_number_x_0 Tests/test_file_libtiff.py::TestFileLibTiff::test_read_icc Tests/test_file_libtiff.py::TestFileLibTiff::test_sampleformat Tests/test_file_libtiff.py::TestFileLibTiff::test_save_bytesio Tests/test_file_libtiff.py::TestFileLibTiff::test_save_tiff_with_jpegtables Tests/test_file_libtiff.py::TestFileLibTiff::test_strip_cmyk_16l_jpeg Tests/test_file_libtiff.py::TestFileLibTiff::test_strip_cmyk_jpeg Tests/test_file_libtiff.py::TestFileLibTiff::test_strip_ycbcr_jpeg_1x1_sampling Tests/test_file_libtiff.py::TestFileLibTiff::test_strip_ycbcr_jpeg_2x2_sampling Tests/test_file_libtiff.py::TestFileLibTiff::test_tiled_cmyk_jpeg Tests/test_file_libtiff.py::TestFileLibTiff::test_tiled_ycbcr_jpeg_1x1_sampling Tests/test_file_libtiff.py::TestFileLibTiff::test_tiled_ycbcr_jpeg_2x2_sampling Tests/test_file_libtiff.py::TestFileLibTiff::test_write_metadata
src/PIL/TiffImagePlugin.py
src/PIL/TiffImagePlugin.py