Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test PBM and LBM images, test and document XCF #2608

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions docs/reST/ref/image.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ formats.

* ``JPEG``

* ``LBM`` (and ``PBM``, ``PGM``, ``PPM``)
* ``LBM``

* ``PCX``

* ``PNG``
* ``PNM``

* ``PNM`` (``PBM``, ``PGM``, ``PPM``)

* ``QOI``

Expand All @@ -46,8 +46,9 @@ formats.
* ``WEBP``

* ``XPM``



* ``XCF``

.. versionaddedold:: 2.0 Loading SVG, WebP, PNM

.. versionadded:: 2.4.0 Loading QOI (Relies on SDL_Image 2.6.0+)
Expand Down
Binary file added examples/data/magenta.lbm
Binary file not shown.
Binary file added examples/data/tomato.xcf
Binary file not shown.
Binary file added examples/data/white.pbm
Binary file not shown.
6 changes: 6 additions & 0 deletions test/image_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1758,14 +1758,20 @@ def test_load_extended(self):
("purple.xpm", (255, 0, 255, 255)),
("black.ppm", (0, 0, 0, 255)),
("grey.pgm", (120, 120, 120, 255)),
("white.pbm", (255, 255, 255, 255)),
("teal.svg", (0, 128, 128, 255)),
("crimson.pnm", (220, 20, 60, 255)),
("scarlet.webp", (252, 14, 53, 255)),
("tomato.xcf", (255, 99, 71, 255)),
]

if pygame.image.get_sdl_image_version() > (2, 0, 5):
filename_expected_color.append(("purple.qoi", (159, 38, 240, 255)))

# SDL_image 2.8.0 and 2.8.1 have an LBM file loading regression
if not (2, 8, 0) <= pygame.image.get_sdl_image_version() < (2, 8, 2):
filename_expected_color.append(("magenta.lbm", (255, 0, 255, 255)))

for filename, expected_color in filename_expected_color:
if filename.endswith("svg") and sdl_image_svg_jpeg_save_bug:
# SDL_image 2.0.5 and older has an svg loading bug on big
Expand Down
Loading