Skip to content

Commit 2946066

Browse files
committed
docs: clarify EXIF orientation formats in v2.0 notes
1 parent 7b7bb5f commit 2946066

2 files changed

Lines changed: 40 additions & 2 deletions

File tree

‎README.rst‎

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ imagesize
1616
:target: https://github.com/shibukawa/imagesize_py/blob/main/LICENSE.rst
1717
:alt: License
1818

19-
This module analyzes JPEG/JPEG 2000/PNG/GIF/TIFF/SVG/Netpbm/WebP/AVIF image headers and returns image size, DPI, and related metadata.
19+
This module analyzes JPEG/JPEG 2000/PNG/GIF/TIFF/SVG/Netpbm/WebP/BMP/AVIF/HEIC/HEIF image headers and returns image size, DPI, and related metadata.
2020

2121
.. code:: python
2222
@@ -35,16 +35,52 @@ This module is a pure Python module. You can use file like object like file or s
3535

3636
Supported Python versions: 3.10-3.14
3737

38+
Installation
39+
----------------
40+
41+
.. code:: bash
42+
43+
pip install imagesize
44+
45+
For local development setup:
46+
47+
.. code:: bash
48+
49+
python -m venv .venv
50+
source .venv/bin/activate
51+
pip install -e .
52+
53+
Version 2.0 migration notes
54+
-----------------------------
55+
56+
Version 2.0 includes the following updates:
57+
58+
* Added/expanded support for ``BMP``.
59+
* Added support for ``AVIF``.
60+
* Added support for ``HEIC/HEIF``.
61+
* ``imagesize.get_info()`` now returns richer metadata including color depth, channel count, and rotation information.
62+
* Improved EXIF orientation handling so JPEG, TIFF, AVIF, and HEIC/HEIF return sizes that correctly reflect EXIF rotation metadata.
63+
* Added type hints for the public API and related input/output types.
64+
65+
Backward incompatible behavior in 2.0:
66+
67+
* ``imagesize.get()`` now returns ``(-1, -1)`` when parsing fails.
68+
* ``imagesize.getDPI()`` now returns ``(-1, -1)`` when parsing fails.
69+
70+
If your existing code relied on exceptions during parse failures, update it to explicitly check return values.
71+
3872
API
3973
-----
4074

4175
* ``imagesize.get(filepath: FileInput, *, exif_rotation: bool = True) -> tuple[int, int]``
4276

4377
Returns image size as ``(width, height)``. By default, orientation metadata is applied for rotated JPEG/TIFF images; pass ``exif_rotation=False`` to get the stored size as-is.
78+
On parsing errors it returns ``(-1, -1)``.
4479

4580
* ``imagesize.getDPI(filepath: FileInput) -> tuple[int, int]``
4681

4782
Returns image DPI as ``(xdpi, ydpi)``.
83+
On parsing errors it returns ``(-1, -1)``.
4884

4985
* ``imagesize.get_info(filepath: FileInput, *, size: bool = True, dpi: bool = True, colors: bool = True, exif_rotation: bool = True, channels: bool = True) -> ImageInfo``
5086

‎setup.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(name='imagesize',
77
version=__version__,
8-
description='Getting image size from png/jpeg/jpeg2000/gif file',
8+
description='Get image size from headers (BMP/PNG/JPEG/JPEG2000/GIF/TIFF/SVG/Netpbm/WebP/AVIF/HEIC/HEIF)',
99
long_description='''
1010
It parses image files' header and return image size.
1111
@@ -18,6 +18,8 @@
1818
* SVG
1919
* Netpbm
2020
* WebP
21+
* AVIF
22+
* HEIC/HEIF
2123
2224
This is a pure Python library.
2325
''',

0 commit comments

Comments
 (0)