mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Swap pixel values on Big Endian
This commit is contained in:
parent
169bb4842f
commit
4c2dfadf26
|
@ -17,7 +17,6 @@ from .helper import (
|
|||
assert_image_similar,
|
||||
assert_image_similar_tofile,
|
||||
hopper,
|
||||
is_big_endian,
|
||||
skip_unless_feature,
|
||||
)
|
||||
|
||||
|
@ -892,7 +891,6 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
with Image.open("Tests/images/tiff_strip_planar_16bit_RGBa.tiff") as im:
|
||||
assert_image_equal_tofile(im, "Tests/images/tiff_16bit_RGBa_target.png")
|
||||
|
||||
@pytest.mark.xfail(is_big_endian(), reason="Fails on big-endian")
|
||||
def test_old_style_jpeg(self):
|
||||
infile = "Tests/images/old-style-jpeg-compression.tif"
|
||||
with Image.open(infile) as im:
|
||||
|
|
|
@ -292,6 +292,10 @@ _decodeStripYCbCr(Imaging im, ImagingCodecState state, TIFF *tiff) {
|
|||
goto decodeycbcr_err;
|
||||
}
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
TIFFSwabArrayOfLong((UINT32 *)state->buffer, img.width * rows_to_read);
|
||||
#endif
|
||||
|
||||
TRACE(("Decoded strip for row %d \n", state->y));
|
||||
|
||||
// iterate over each row in the strip and stuff data into image
|
||||
|
@ -623,6 +627,10 @@ ImagingLibTiffDecode(
|
|||
state->errcode = IMAGING_CODEC_BROKEN;
|
||||
goto decode_err;
|
||||
}
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
TIFFSwabArrayOfLong((UINT32 *)state->buffer, tile_width * tile_length);
|
||||
#endif
|
||||
} else {
|
||||
if (TIFFReadTile(tiff, (tdata_t)state->buffer, x, y, 0, plane) == -1) {
|
||||
TRACE(("Decode Error, Tile at %dx%d\n", x, y));
|
||||
|
|
Loading…
Reference in New Issue
Block a user