Merge branch 'main' into imagegrab_resize
|
|
@ -27,14 +27,13 @@ python3 -m pip install --upgrade wheel
|
|||
python3 -m pip install coverage
|
||||
python3 -m pip install defusedxml
|
||||
python3 -m pip install ipython
|
||||
python3 -m pip install numpy
|
||||
python3 -m pip install olefile
|
||||
python3 -m pip install -U pytest
|
||||
python3 -m pip install -U pytest-cov
|
||||
python3 -m pip install -U pytest-timeout
|
||||
python3 -m pip install pyroma
|
||||
# optional test dependency, only install if there's a binary package.
|
||||
# fails on beta 3.14 and PyPy
|
||||
# optional test dependencies, only install if there's a binary package.
|
||||
python3 -m pip install --only-binary=:all: numpy || true
|
||||
python3 -m pip install --only-binary=:all: pyarrow || true
|
||||
|
||||
# PyQt6 doesn't support PyPy3
|
||||
|
|
|
|||
5
.github/workflows/macos-install.sh
vendored
|
|
@ -26,9 +26,8 @@ python3 -m pip install -U pytest
|
|||
python3 -m pip install -U pytest-cov
|
||||
python3 -m pip install -U pytest-timeout
|
||||
python3 -m pip install pyroma
|
||||
python3 -m pip install numpy
|
||||
# optional test dependency, only install if there's a binary package.
|
||||
# fails on beta 3.14 and PyPy
|
||||
# optional test dependencies, only install if there's a binary package.
|
||||
python3 -m pip install --only-binary=:all: numpy || true
|
||||
python3 -m pip install --only-binary=:all: pyarrow || true
|
||||
|
||||
# libavif
|
||||
|
|
|
|||
2
.github/workflows/test-windows.yml
vendored
|
|
@ -35,7 +35,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["pypy3.11", "3.11", "3.12", "3.13", "3.14"]
|
||||
python-version: ["pypy3.11", "3.11", "3.12", "3.13", "3.14", "3.15"]
|
||||
architecture: ["x64"]
|
||||
include:
|
||||
# Test the oldest Python on 32-bit
|
||||
|
|
|
|||
3
.github/workflows/test.yml
vendored
|
|
@ -42,6 +42,8 @@ jobs:
|
|||
]
|
||||
python-version: [
|
||||
"pypy3.11",
|
||||
"3.15t",
|
||||
"3.15",
|
||||
"3.14t",
|
||||
"3.14",
|
||||
"3.13t",
|
||||
|
|
@ -54,6 +56,7 @@ jobs:
|
|||
- { python-version: "3.12", PYTHONOPTIMIZE: 1, REVERSE: "--reverse" }
|
||||
- { python-version: "3.11", PYTHONOPTIMIZE: 2 }
|
||||
# Free-threaded
|
||||
- { python-version: "3.15t", disable-gil: true }
|
||||
- { python-version: "3.14t", disable-gil: true }
|
||||
- { python-version: "3.13t", disable-gil: true }
|
||||
# Intel
|
||||
|
|
|
|||
2
.github/workflows/wheels-dependencies.sh
vendored
|
|
@ -96,7 +96,7 @@ else
|
|||
FREETYPE_VERSION=2.14.1
|
||||
fi
|
||||
HARFBUZZ_VERSION=12.2.0
|
||||
LIBPNG_VERSION=1.6.51
|
||||
LIBPNG_VERSION=1.6.53
|
||||
JPEGTURBO_VERSION=3.1.2
|
||||
OPENJPEG_VERSION=2.5.4
|
||||
XZ_VERSION=5.8.1
|
||||
|
|
|
|||
2
.github/zizmor.yml
vendored
|
|
@ -1,6 +1,8 @@
|
|||
# Configuration for the zizmor static analysis tool, run via pre-commit in CI
|
||||
# https://docs.zizmor.sh/configuration/
|
||||
rules:
|
||||
obfuscation:
|
||||
disable: true
|
||||
unpinned-uses:
|
||||
config:
|
||||
policies:
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.14.3
|
||||
rev: v0.14.7
|
||||
hooks:
|
||||
- id: ruff-check
|
||||
args: [--exit-non-zero-on-fix]
|
||||
|
||||
- repo: https://github.com/psf/black-pre-commit-mirror
|
||||
rev: 25.9.0
|
||||
rev: 25.11.0
|
||||
hooks:
|
||||
- id: black
|
||||
|
||||
- repo: https://github.com/PyCQA/bandit
|
||||
rev: 1.8.6
|
||||
rev: 1.9.2
|
||||
hooks:
|
||||
- id: bandit
|
||||
args: [--severity-level=high]
|
||||
|
|
@ -24,7 +24,7 @@ repos:
|
|||
exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.gd$|\.opt$)
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||
rev: v21.1.2
|
||||
rev: v21.1.6
|
||||
hooks:
|
||||
- id: clang-format
|
||||
types: [c]
|
||||
|
|
@ -51,24 +51,24 @@ repos:
|
|||
exclude: ^\.github/.*TEMPLATE|^Tests/(fonts|images)/
|
||||
|
||||
- repo: https://github.com/python-jsonschema/check-jsonschema
|
||||
rev: 0.34.1
|
||||
rev: 0.35.0
|
||||
hooks:
|
||||
- id: check-github-workflows
|
||||
- id: check-readthedocs
|
||||
- id: check-renovate
|
||||
|
||||
- repo: https://github.com/zizmorcore/zizmor-pre-commit
|
||||
rev: v1.16.2
|
||||
rev: v1.18.0
|
||||
hooks:
|
||||
- id: zizmor
|
||||
|
||||
- repo: https://github.com/sphinx-contrib/sphinx-lint
|
||||
rev: v1.0.1
|
||||
rev: v1.0.2
|
||||
hooks:
|
||||
- id: sphinx-lint
|
||||
|
||||
- repo: https://github.com/tox-dev/pyproject-fmt
|
||||
rev: v2.11.0
|
||||
rev: v2.11.1
|
||||
hooks:
|
||||
- id: pyproject-fmt
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 126 B |
|
|
@ -1,578 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>BMP Suite Image List</title>
|
||||
|
||||
<style>
|
||||
.b { background:url(bkgd.png); }
|
||||
.q { background-color:#fff0e0; }
|
||||
.bad { background-color:#ffa0a0; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>BMP Suite Image List</h1>
|
||||
|
||||
<p><i>For <a href="http://entropymine.com/jason/bmpsuite/">BMP Suite</a>
|
||||
version 2.3</i></p>
|
||||
|
||||
<p>This document describes the images in <i>BMP Suite</i>, and shows what
|
||||
I allege to be the correct way to interpret them. PNG and JPEG images are
|
||||
used for reference.
|
||||
</p>
|
||||
|
||||
<p>It also shows how your web browser displays the BMP images,
|
||||
but that’s not its main purpose.
|
||||
BMP is poor image format to use on web pages, so a web browser’s
|
||||
level of support for it is arguably not important.</p>
|
||||
|
||||
<table border=1 cellpadding=8>
|
||||
|
||||
<tr>
|
||||
<th>File</th>
|
||||
<th>Ver.</th>
|
||||
<th>Correct display</th>
|
||||
<th>In your browser</th>
|
||||
<th>Notes</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/pal1.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal1.png"></td>
|
||||
<td class=b><img src="../g/pal1.bmp"></td>
|
||||
<td>1 bit/pixel paletted image, in which black is the first color in
|
||||
the palette.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/pal1wb.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal1.png"></td>
|
||||
<td class=b><img src="../g/pal1wb.bmp"></td>
|
||||
<td>1 bit/pixel paletted image, in which white is the first color in
|
||||
the palette.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/pal1bg.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal1bg.png"></td>
|
||||
<td class=b><img src="../g/pal1bg.bmp"></td>
|
||||
<td>1 bit/pixel paletted image, with colors other than black and white.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/pal1p1.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal1p1.png"></td>
|
||||
<td class=b><img src="../q/pal1p1.bmp"></td>
|
||||
<td>1 bit/pixel paletted image, with only one color in the palette.
|
||||
The documentation says that 1-bpp images have a palette size of 2
|
||||
(not “up to 2”), but it would be silly for a viewer not to
|
||||
support a size of 1.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/pal2.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal2.png"></td>
|
||||
<td class=b><img src="../q/pal2.bmp"></td>
|
||||
<td>A paletted image with 2 bits/pixel. Usually only 1, 4,
|
||||
and 8 are allowed, but 2 is legal on Windows CE.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/pal4.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal4.png"></td>
|
||||
<td class=b><img src="../g/pal4.bmp"></td>
|
||||
<td>Paletted image with 12 palette colors, and 4 bits/pixel.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/pal4rle.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal4.png"></td>
|
||||
<td class=b><img src="../g/pal4rle.bmp"></td>
|
||||
<td>4-bit image that uses RLE compression.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/pal4rletrns.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal4rletrns.png"><br>
|
||||
or<br><img src="pal4rletrns-0.png"><br>
|
||||
or<br><img src="pal4rletrns-b.png"></td>
|
||||
<td class=b><img src="../q/pal4rletrns.bmp"></td>
|
||||
<td>An RLE-compressed image that used “delta”
|
||||
codes to skip over some pixels, leaving them undefined. Some viewers
|
||||
make undefined pixels transparent, others make them black, and
|
||||
others assign them palette color 0 (purple, in this case).</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/pal8.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal8.png"></td>
|
||||
<td class=b><img src="../g/pal8.bmp"></td>
|
||||
<td>Our standard paletted image, with 252 palette colors, and 8
|
||||
bits/pixel.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/pal8-0.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal8.png"></td>
|
||||
<td class=b><img src="../g/pal8-0.bmp"></td>
|
||||
<td>Every field that can be set to 0 is set to 0: pixels/meter=0;
|
||||
colors used=0 (meaning the default 256); size-of-image=0.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/pal8rle.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal8.png"></td>
|
||||
<td class=b><img src="../g/pal8rle.bmp"></td>
|
||||
<td>8-bit image that uses RLE compression.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/pal8rletrns.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal8rletrns.png"><br>
|
||||
or<br><img src="pal8rletrns-0.png"><br>
|
||||
or<br><img src="pal8rletrns-b.png"></td>
|
||||
<td class=b><img src="../q/pal8rletrns.bmp"></td>
|
||||
<td>8-bit version of q/pal4rletrns.bmp.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/pal8w126.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal8w126.png"></td>
|
||||
<td class=b><img src="../g/pal8w126.bmp"></td>
|
||||
<td rowspan=3>Images with different widths and heights.
|
||||
In BMP format, rows are padded to a multiple of four bytes, so we
|
||||
test all four possibilities.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/pal8w125.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal8w125.png"></td>
|
||||
<td class=b><img src="../g/pal8w125.bmp"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/pal8w124.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal8w124.png"></td>
|
||||
<td class=b><img src="../g/pal8w124.bmp"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/pal8topdown.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal8.png"></td>
|
||||
<td class=b><img src="../g/pal8topdown.bmp"></td>
|
||||
<td>BMP images are normally stored from the bottom up, but
|
||||
there is a way to store them from the top down.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/pal8offs.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal8.png"></td>
|
||||
<td class=b><img src="../q/pal8offs.bmp"></td>
|
||||
<td>A file with some unused bytes between the palette and the
|
||||
image. This is probably valid, but I’m not 100% sure.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/pal8oversizepal.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal8.png"></td>
|
||||
<td class=b><img src="../q/pal8oversizepal.bmp"></td>
|
||||
<td>An 8-bit image with 300 palette colors. This may be invalid,
|
||||
because the documentation could
|
||||
be interpreted to imply that 8-bit images aren’t allowed
|
||||
to have more than 256 colors.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/pal8nonsquare.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b>
|
||||
<img src="pal8nonsquare-v.png"><br>
|
||||
or<br>
|
||||
<img src="pal8nonsquare-e.png">
|
||||
</td>
|
||||
<td class=b><img src="../g/pal8nonsquare.bmp"></td>
|
||||
<td>An image with non-square pixels: the X pixels/meter is twice
|
||||
the Y pixels/meter. Image <i>editors</i> can be expected to
|
||||
leave the image “squashed”; image <i>viewers</i> should
|
||||
consider stretching it to its correct proportions.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/pal8os2.bmp</td>
|
||||
<td>OS/2v1</td>
|
||||
<td class=b><img src="pal8.png"></td>
|
||||
<td class=b><img src="../g/pal8os2.bmp"></td>
|
||||
<td>An OS/2-style bitmap.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/pal8os2sp.bmp</td>
|
||||
<td>OS/2v1</td>
|
||||
<td class=b><img src="pal8.png"></td>
|
||||
<td class=b><img src="../q/pal8os2sp.bmp"></td>
|
||||
<td>An OS/2v1 with a less-than-full-sized palette.
|
||||
Probably not valid, but such files have been seen in the wild.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/pal8os2v2.bmp</td>
|
||||
<td>OS/2v2</td>
|
||||
<td class=b><img src="pal8.png"></td>
|
||||
<td class=b><img src="../q/pal8os2v2.bmp"></td>
|
||||
<td>My attempt to make an OS/2v2 bitmap.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/pal8os2v2-16.bmp</td>
|
||||
<td>OS/2v2</td>
|
||||
<td class=b><img src="pal8.png"></td>
|
||||
<td class=b><img src="../q/pal8os2v2-16.bmp"></td>
|
||||
<td>An OS/2v2 bitmap whose header has only 16 bytes, instead of the full 64.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/pal8v4.bmp</td>
|
||||
<td>4</td>
|
||||
<td class=b><img src="pal8.png"></td>
|
||||
<td class=b><img src="../g/pal8v4.bmp"></td>
|
||||
<td>A v4 bitmap. I’m not sure that the gamma and chromaticity values in
|
||||
this file are sensible, because I can’t find any detailed documentation
|
||||
of them.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/pal8v5.bmp</td>
|
||||
<td>5</td>
|
||||
<td class=b><img src="pal8.png"></td>
|
||||
<td class=b><img src="../g/pal8v5.bmp"></td>
|
||||
<td>A v5 bitmap. Version 5 has additional colorspace options over v4, so it
|
||||
is easier to create, and ought to be more portable.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/rgb16.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="rgb16.png"></td>
|
||||
<td class=b><img src="../g/rgb16.bmp"></td>
|
||||
<td>A 16-bit image with the default color format: 5 bits each for red,
|
||||
green, and blue, and 1 unused bit.
|
||||
The whitest colors should (I assume) be displayed as pure white:
|
||||
<span style="background-color:rgb(255,255,255)">(255,255,255)</span>, not
|
||||
<span style="background-color:rgb(248,248,248)">(248,248,248)</span>.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/rgb16-565.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="rgb16-565.png"></td>
|
||||
<td class=b><img src="../g/rgb16-565.bmp"></td>
|
||||
<td>A 16-bit image with a BITFIELDS segment indicating 5 red, 6 green,
|
||||
and 5 blue bits. This is a standard 16-bit format, even supported by
|
||||
old versions of Windows that don’t support any other non-default 16-bit
|
||||
formats.
|
||||
The whitest colors should be displayed as pure white:
|
||||
<span style="background-color:rgb(255,255,255)">(255,255,255)</span>, not
|
||||
<span style="background-color:rgb(248,252,248)">(248,252,248)</span>.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/rgb16-565pal.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="rgb16-565.png"></td>
|
||||
<td class=b><img src="../g/rgb16-565pal.bmp"></td>
|
||||
<td>A 16-bit image with both a BITFIELDS segment and a palette.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/rgb16-231.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="rgb16-231.png"></td>
|
||||
<td class=b><img src="../q/rgb16-231.bmp"></td>
|
||||
<td>An unusual and silly 16-bit image, with 2 red bits, 3 green bits, and 1
|
||||
blue bit. Most viewers do support this image, but the colors may be darkened
|
||||
with a yellow-green shadow. That’s because they’re doing simple
|
||||
bit-shifting (possibly including one round of bit replication), instead of
|
||||
proper scaling.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/rgba16-4444.bmp</td>
|
||||
<td>5</td>
|
||||
<td class=b><img src="rgba16-4444.png"></td>
|
||||
<td class=b><img src="../q/rgba16-4444.bmp"></td>
|
||||
<td>A 16-bit image with an alpha channel. There are 4 bits for each color
|
||||
channel, and 4 bits for the alpha channel.
|
||||
It’s not clear if this is valid, but I can’t find anything that
|
||||
suggests it isn’t.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/rgb24.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="rgb24.png"></td>
|
||||
<td class=b><img src="../g/rgb24.bmp"></td>
|
||||
<td>A perfectly ordinary 24-bit (truecolor) image.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/rgb24pal.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="rgb24.png"></td>
|
||||
<td class=b><img src="../g/rgb24pal.bmp"></td>
|
||||
<td>A 24-bit image, with a palette containing 256 colors. There is little if
|
||||
any reason for a truecolor image to contain a palette, but it is legal.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/rgb24largepal.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="rgb24.png"></td>
|
||||
<td class=b><img src="../q/rgb24largepal.bmp"></td>
|
||||
<td>A 24-bit image, with a palette containing 300 colors.
|
||||
The fact that the palette has more than 256 colors may cause some viewers
|
||||
to complain, but the documentation does not mention a size limit.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/rgb24prof.bmp</td>
|
||||
<td>5</td>
|
||||
<td class=b><img src="rgb24.png"></td>
|
||||
<td class=b><img src="../q/rgb24prof.bmp"></td>
|
||||
<td>My attempt to make a BMP file with an embedded color profile.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/rgb24lprof.bmp</td>
|
||||
<td>5</td>
|
||||
<td class=b><img src="rgb24.png"></td>
|
||||
<td class=b><img src="../q/rgb24lprof.bmp"></td>
|
||||
<td>My attempt to make a BMP file with a linked color profile.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/rgb24jpeg.bmp</td>
|
||||
<td>5</td>
|
||||
<td class=b><img src="rgb24.jpg"></td>
|
||||
<td class=b><img src="../q/rgb24jpeg.bmp"></td>
|
||||
<td rowspan=2>My attempt to make BMP files with embedded JPEG and PNG images.
|
||||
These are not likely to be supported by much of anything (they’re
|
||||
intended for printers).</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/rgb24png.bmp</td>
|
||||
<td>5</td>
|
||||
<td class=b><img src="rgb24.png"></td>
|
||||
<td class=b><img src="../q/rgb24png.bmp"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/rgb32.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="rgb24.png"></td>
|
||||
<td class=b><img src="../g/rgb32.bmp"></td>
|
||||
<td>A 32-bit image using the default color format for 32-bit images (no
|
||||
BITFIELDS segment). There are 8 bits per color channel, and 8 unused
|
||||
bits. The unused bits are set to 0.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>g/rgb32bf.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="rgb24.png"></td>
|
||||
<td class=b><img src="../g/rgb32bf.bmp"></td>
|
||||
<td>A 32-bit image with a BITFIELDS segment. As usual, there are 8 bits per
|
||||
color channel, and 8 unused bits. But the color channels are in an unusual
|
||||
order, so the viewer must read the BITFIELDS, and not just guess.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/rgb32fakealpha.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="rgb24.png"><br>
|
||||
or<br>
|
||||
<img class=b src="fakealpha.png">
|
||||
</td>
|
||||
<td class=b><img src="../q/rgb32fakealpha.bmp"></td>
|
||||
<td>Same as g/rgb32.bmp, except that the unused bits are set to something
|
||||
other than 0.
|
||||
If the image becomes transparent toward the bottom, it probably means
|
||||
the viewer uses heuristics to guess whether the undefined
|
||||
data represents transparency.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/rgb32-111110.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="rgb24.png"></td>
|
||||
<td class=b><img src="../q/rgb32-111110.bmp"></td>
|
||||
<td>A 32 bits/pixel image, with all 32 bits used: 11 each for red and
|
||||
green, and 10 for blue. As far as I know, this is perfectly valid, but it
|
||||
is unusual.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/rgba32.bmp</td>
|
||||
<td>5</td>
|
||||
<td class=b><img src="rgba32.png"></td>
|
||||
<td class=b><img src="../q/rgba32.bmp"></td>
|
||||
<td>A BMP with an alpha channel. Transparency is barely documented,
|
||||
so it’s <i>possible</i> that this file is not correctly formed.
|
||||
The color channels are in an unusual order, to prevent viewers from
|
||||
passing this test by making a lucky guess.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=q>q/rgba32abf.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="rgba32.png"></td>
|
||||
<td class=b><img src="../q/rgba32abf.bmp"></td>
|
||||
<td>An image of type BI_ALHPABITFIELDS. Supposedly, this was used on
|
||||
Windows CE. I don’t know whether it is constructed correctly.</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class=bad>b/badbitcount.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b>N/A</td>
|
||||
<td class=b><img src="../b/badbitcount.bmp"></td>
|
||||
<td>Header indicates an absurdly large number of bits/pixel.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=bad>b/badbitssize.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b>N/A</td>
|
||||
<td class=b><img src="../b/badbitssize.bmp"></td>
|
||||
<td>Header incorrectly indicates that the bitmap is several GB in size.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=bad>b/baddens1.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b>N/A</td>
|
||||
<td class=b><img src="../b/baddens1.bmp"></td>
|
||||
<td rowspan=2>Density (pixels per meter) suggests the image is <i>much</i>
|
||||
larger in one dimension than the other.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=bad>b/baddens2.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b>N/A</td>
|
||||
<td class=b><img src="../b/baddens2.bmp"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=bad>b/badfilesize.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b>N/A</td>
|
||||
<td class=b><img src="../b/badfilesize.bmp"></td>
|
||||
<td>Header incorrectly indicates that the file is several GB in size.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=bad>b/badheadersize.bmp</td>
|
||||
<td>?</td>
|
||||
<td class=b>N/A</td>
|
||||
<td class=b><img src="../b/badheadersize.bmp"></td>
|
||||
<td>Header size is 66 bytes, which is not a valid size for any known BMP
|
||||
version.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=bad>b/badpalettesize.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b>N/A</td>
|
||||
<td class=b><img src="../b/badpalettesize.bmp"></td>
|
||||
<td>Header incorrectly indicates that the palette contains an absurdly large
|
||||
number of colors.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=bad>b/badplanes.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b>N/A</td>
|
||||
<td class=b><img src="../b/badplanes.bmp"></td>
|
||||
<td>The “planes” setting, which is required to be 1, is not 1.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=bad>b/badrle.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b>N/A</td>
|
||||
<td class=b><img src="../b/badrle.bmp"></td>
|
||||
<td>An invalid RLE-compressed image that tries to cause buffer overruns.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=bad>b/badwidth.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b>N/A</td>
|
||||
<td class=b><img src="../b/badwidth.bmp"></td>
|
||||
<td>The image claims to be a negative number of pixels in width.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=bad>b/pal8badindex.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b>N/A</td>
|
||||
<td class=b><img src="../b/pal8badindex.bmp"></td>
|
||||
<td>Many of the palette indices used in the image are not present in the
|
||||
palette.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=bad>b/reallybig.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b>N/A</td>
|
||||
<td class=b><img src="../b/reallybig.bmp"></td>
|
||||
<td>An image with a very large reported width and height.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=bad>b/rletopdown.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b>N/A</td>
|
||||
<td class=b><img src="../b/rletopdown.bmp"></td>
|
||||
<td>An RLE-compressed image that tries to use top-down orientation,
|
||||
which isn’t allowed.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class=bad>b/shortfile.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b>N/A</td>
|
||||
<td class=b><img src="../b/shortfile.bmp"></td>
|
||||
<td>A file that has been truncated in the middle of the bitmap.</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 124 B |
|
Before Width: | Height: | Size: 961 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
|
@ -72,7 +72,7 @@ def test_good() -> None:
|
|||
"pal8-0.bmp": "pal8.png",
|
||||
"pal8rle.bmp": "pal8.png",
|
||||
"pal8topdown.bmp": "pal8.png",
|
||||
"pal8nonsquare.bmp": "pal8nonsquare-v.png",
|
||||
"pal8nonsquare.bmp": "pal8nonsquare-e.png",
|
||||
"pal8os2.bmp": "pal8.png",
|
||||
"pal8os2sp.bmp": "pal8.png",
|
||||
"pal8os2v2.bmp": "pal8.png",
|
||||
|
|
@ -103,7 +103,7 @@ def test_good() -> None:
|
|||
# with paletized image, since the palette might
|
||||
# be differently ordered for an equivalent image.
|
||||
im = im.convert("RGBA")
|
||||
compare = im.convert("RGBA")
|
||||
compare = compare.convert("RGBA")
|
||||
assert_image_similar(im, compare, 5)
|
||||
|
||||
except Exception as msg:
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ def test_handler(tmp_path: Path) -> None:
|
|||
def open(self, im: Image.Image) -> None:
|
||||
self.opened = True
|
||||
|
||||
def load(self, im: Image.Image) -> Image.Image:
|
||||
def load(self, im: ImageFile.ImageFile) -> Image.Image:
|
||||
self.loaded = True
|
||||
im.fp.close()
|
||||
return Image.new("RGB", (1, 1))
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ def test_handler(tmp_path: Path) -> None:
|
|||
def open(self, im: Image.Image) -> None:
|
||||
self.opened = True
|
||||
|
||||
def load(self, im: Image.Image) -> Image.Image:
|
||||
def load(self, im: ImageFile.ImageFile) -> Image.Image:
|
||||
self.loaded = True
|
||||
im.fp.close()
|
||||
return Image.new("RGB", (1, 1))
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ def test_getiptcinfo_tiff() -> None:
|
|||
|
||||
# Test with LONG tag type
|
||||
with Image.open("Tests/images/hopper.Lab.tif") as im:
|
||||
assert isinstance(im, TiffImagePlugin.TiffImageFile)
|
||||
im.tag_v2.tagtype[TiffImagePlugin.IPTC_NAA_CHUNK] = TiffTags.LONG
|
||||
iptc = IptcImagePlugin.getiptcinfo(im)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,15 @@ from typing import Any, NamedTuple
|
|||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageFilter, ImageOps, TiffImagePlugin, TiffTags, features
|
||||
from PIL import (
|
||||
Image,
|
||||
ImageFile,
|
||||
ImageFilter,
|
||||
ImageOps,
|
||||
TiffImagePlugin,
|
||||
TiffTags,
|
||||
features,
|
||||
)
|
||||
from PIL.TiffImagePlugin import OSUBFILETYPE, SAMPLEFORMAT, STRIPOFFSETS, SUBIFD
|
||||
|
||||
from .helper import (
|
||||
|
|
@ -27,7 +35,7 @@ from .helper import (
|
|||
|
||||
@skip_unless_feature("libtiff")
|
||||
class LibTiffTestCase:
|
||||
def _assert_noerr(self, tmp_path: Path, im: TiffImagePlugin.TiffImageFile) -> None:
|
||||
def _assert_noerr(self, tmp_path: Path, im: ImageFile.ImageFile) -> None:
|
||||
"""Helper tests that assert basic sanity about the g4 tiff reading"""
|
||||
# 1 bit
|
||||
assert im.mode == "1"
|
||||
|
|
@ -370,6 +378,7 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
im.save(out, tiffinfo=ifd)
|
||||
|
||||
with Image.open(out) as reloaded:
|
||||
assert isinstance(reloaded, TiffImagePlugin.TiffImageFile)
|
||||
assert reloaded.tag_v2[37000] == 100
|
||||
|
||||
def test_inknames_tag(
|
||||
|
|
@ -1146,9 +1155,9 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
with Image.open("Tests/images/g4_orientation_1.tif") as base_im:
|
||||
for i in range(2, 9):
|
||||
with Image.open("Tests/images/g4_orientation_" + str(i) + ".tif") as im:
|
||||
im = ImageOps.exif_transpose(im)
|
||||
im_transposed = ImageOps.exif_transpose(im)
|
||||
|
||||
assert_image_similar(base_im, im, 0.7)
|
||||
assert_image_similar(base_im, im_transposed, 0.7)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_file",
|
||||
|
|
|
|||
|
|
@ -787,7 +787,9 @@ class TestFilePng:
|
|||
im.save(test_file, exif=im.getexif())
|
||||
|
||||
with Image.open(test_file) as reloaded:
|
||||
assert isinstance(reloaded, PngImagePlugin.PngImageFile)
|
||||
exif = reloaded._getexif()
|
||||
assert exif is not None
|
||||
assert exif[305] == "Adobe Photoshop CS Macintosh"
|
||||
|
||||
def test_exif_argument(self, tmp_path: Path) -> None:
|
||||
|
|
|
|||
59
docs/releasenotes/12.1.0.rst
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
12.1.0
|
||||
------
|
||||
|
||||
Security
|
||||
========
|
||||
|
||||
TODO
|
||||
^^^^
|
||||
|
||||
TODO
|
||||
|
||||
:cve:`YYYY-XXXXX`: TODO
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
TODO
|
||||
|
||||
Backwards incompatible changes
|
||||
==============================
|
||||
|
||||
TODO
|
||||
^^^^
|
||||
|
||||
TODO
|
||||
|
||||
Deprecations
|
||||
============
|
||||
|
||||
TODO
|
||||
^^^^
|
||||
|
||||
TODO
|
||||
|
||||
API changes
|
||||
===========
|
||||
|
||||
TODO
|
||||
^^^^
|
||||
|
||||
TODO
|
||||
|
||||
API additions
|
||||
=============
|
||||
|
||||
Specify window in ImageGrab on macOS
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
When using :py:meth:`~PIL.ImageGrab.grab`, a specific window can now be selected on
|
||||
macOS in addition to Windows. On macOS, this is a CGWindowID::
|
||||
|
||||
from PIL import ImageGrab
|
||||
ImageGrab.grab(window=cgwindowid)
|
||||
|
||||
Other changes
|
||||
=============
|
||||
|
||||
TODO
|
||||
^^^^
|
||||
|
||||
TODO
|
||||
|
|
@ -14,6 +14,7 @@ expected to be backported to earlier versions.
|
|||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
12.1.0
|
||||
12.0.0
|
||||
11.3.0
|
||||
11.2.1
|
||||
|
|
|
|||
|
|
@ -40,12 +40,14 @@ def testimage() -> None:
|
|||
>>> with Image.open("Tests/images/hopper.gif") as im:
|
||||
... _info(im)
|
||||
('GIF', 'P', (128, 128))
|
||||
>>> _info(Image.open("Tests/images/hopper.ppm"))
|
||||
>>> with Image.open("Tests/images/hopper.ppm") as im:
|
||||
... _info(im)
|
||||
('PPM', 'RGB', (128, 128))
|
||||
>>> try:
|
||||
... _info(Image.open("Tests/images/hopper.jpg"))
|
||||
... with Image.open("Tests/images/hopper.jpg") as im:
|
||||
... _info(im)
|
||||
... except OSError as v:
|
||||
... print(v)
|
||||
... print(v)
|
||||
('JPEG', 'RGB', (128, 128))
|
||||
|
||||
PIL doesn't actually load the image data until it's needed,
|
||||
|
|
|
|||
|
|
@ -116,8 +116,8 @@ class GifImageFile(ImageFile.ImageFile):
|
|||
# check if palette contains colour indices
|
||||
p = self.fp.read(3 << bits)
|
||||
if self._is_palette_needed(p):
|
||||
p = ImagePalette.raw("RGB", p)
|
||||
self.global_palette = self.palette = p
|
||||
palette = ImagePalette.raw("RGB", p)
|
||||
self.global_palette = self.palette = palette
|
||||
|
||||
self._fp = self.fp # FIXME: hack
|
||||
self.__rewind = self.fp.tell()
|
||||
|
|
@ -256,7 +256,7 @@ class GifImageFile(ImageFile.ImageFile):
|
|||
info["comment"] += b"\n" + comment
|
||||
else:
|
||||
info["comment"] = comment
|
||||
s = None
|
||||
s = b""
|
||||
continue
|
||||
elif s[0] == 255 and frame == 0 and block is not None:
|
||||
#
|
||||
|
|
@ -299,7 +299,7 @@ class GifImageFile(ImageFile.ImageFile):
|
|||
bits = self.fp.read(1)[0]
|
||||
self.__offset = self.fp.tell()
|
||||
break
|
||||
s = None
|
||||
s = b""
|
||||
|
||||
if interlace is None:
|
||||
msg = "image not found in GIF frame"
|
||||
|
|
|
|||
|
|
@ -1519,6 +1519,9 @@ class Image:
|
|||
"".join(self.info["Raw profile type exif"].split("\n")[3:])
|
||||
)
|
||||
elif hasattr(self, "tag_v2"):
|
||||
from . import TiffImagePlugin
|
||||
|
||||
assert isinstance(self, TiffImagePlugin.TiffImageFile)
|
||||
self._exif.bigtiff = self.tag_v2._bigtiff
|
||||
self._exif.endian = self.tag_v2._endian
|
||||
self._exif.load_from_fp(self.fp, self.tag_v2._offset)
|
||||
|
|
|
|||
|
|
@ -66,10 +66,10 @@ class XVThumbImageFile(ImageFile.ImageFile):
|
|||
break
|
||||
|
||||
# parse header line (already read)
|
||||
s = s.strip().split()
|
||||
w, h = s.strip().split(maxsplit=2)[:2]
|
||||
|
||||
self._mode = "P"
|
||||
self._size = int(s[0]), int(s[1])
|
||||
self._size = int(w), int(h)
|
||||
|
||||
self.palette = ImagePalette.raw("RGB", PALETTE)
|
||||
|
||||
|
|
|
|||
2
tox.ini
|
|
@ -3,7 +3,7 @@ requires =
|
|||
tox>=4.2
|
||||
env_list =
|
||||
lint
|
||||
py{py3, 314, 313, 312, 311, 310}
|
||||
py{py3, 315, 314, 313, 312, 311, 310}
|
||||
|
||||
[testenv]
|
||||
deps =
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ V = {
|
|||
"LCMS2": "2.17",
|
||||
"LIBAVIF": "1.3.0",
|
||||
"LIBIMAGEQUANT": "4.4.1",
|
||||
"LIBPNG": "1.6.51",
|
||||
"LIBPNG": "1.6.53",
|
||||
"LIBWEBP": "1.6.0",
|
||||
"OPENJPEG": "2.5.4",
|
||||
"TIFF": "4.7.1",
|
||||
|
|
|
|||