diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py
index 66b211cbf..c1a785ef3 100644
--- a/src/PIL/TiffImagePlugin.py
+++ b/src/PIL/TiffImagePlugin.py
@@ -567,6 +567,9 @@ class ImageFileDirectory_v2(MutableMapping):
         if self.tagtype[tag] == 7 and py3:
             values = [value.encode("ascii", 'replace') if isinstance(
                       value, str) else value]
+        elif self.tagtype[tag] == 5:
+            values = [float(v) if isinstance(v, int) else v
+                      for v in values]
 
         values = tuple(info.cvt_enum(value) for value in values)
 

Save compressed TIFF only accepts float values for dpi
There is a trap in setting the resolution for compressed TIFF images.  

```python
# pillow v3.1.1

import PIL.Image
im = PIL.Image.new('CMYK', (100, 100))

dpi = 100.0  # works
dpi = 100  # fails

im.save('test.tif', format='TIFF',
        dpi=(dpi, dpi),
        compression='tiff_lzw',
        #compression='tiff_deflate',
        #compression='tiff_adobe_deflate'
        )
```

Integers fail silently resulting in the resolution value missing from the saved file. Floats work as expected.

diff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py
index 77caa0b9d..7735b5bea 100644
--- a/Tests/test_file_libtiff.py
+++ b/Tests/test_file_libtiff.py
@@ -231,6 +231,16 @@ class TestFileLibTiff(LibTiffTestCase):
 
         TiffImagePlugin.WRITE_LIBTIFF = False
 
+    def test_int_dpi(self):
+        # issue #1765
+        im = hopper('RGB')
+        out = self.tempfile('temp.tif')
+        TiffImagePlugin.WRITE_LIBTIFF = True
+        im.save(out, dpi=(72, 72))
+        TiffImagePlugin.WRITE_LIBTIFF = False
+        reloaded = Image.open(out)
+        self.assertEqual(reloaded.info['dpi'], (72.0, 72.0))
+
     def test_g3_compression(self):
         i = Image.open('Tests/images/hopper_g4_500.tif')
         out = self.tempfile("temp.tif")

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
blessed==1.20.0
build==1.2.2.post1
certifi==2025.1.31
charset-normalizer==3.4.1
check-manifest==0.50
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
olefile==0.47
packaging==24.2
-e git+https://github.com/python-pillow/Pillow.git@41954f244705b247667f1ea228e932ca6390bcd6#egg=Pillow
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
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
      - blessed==1.20.0
      - build==1.2.2.post1
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - check-manifest==0.50
      - 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
      - olefile==0.47
      - packaging==24.2
      - 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
      - urllib3==2.3.0
      - wcwidth==0.2.13
      - zipp==3.21.0
prefix: /opt/conda/envs/Pillow

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_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_write_metadata
Tests/test_file_libtiff.py::TestFileLibTiff::test_12bit_rawmode Tests/test_file_libtiff.py::TestFileLibTiff::test_16bit_RGBa_tiff 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_adobe_deflate_tiff 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_gimp_tiff Tests/test_file_libtiff.py::TestFileLibTiff::test_gray_semibyte_per_pixel
src/PIL/TiffImagePlugin.py
src/PIL/TiffImagePlugin.py