Skip to content

Commit 2ac1734

Browse files
committed
Fix crash when trying to write 16-bit TIFF file (LP bug 1222922)
Note: does not actually add support for writing 16-bit tifs; Panda just doesn't crash but automatically downsamples to 8-bit.
1 parent 601b6b8 commit 2ac1734

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

doc/ReleaseNotes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ remained in the 1.9.1 release, including:
7676
* Fix constant reloading of texture when gl-ignore-mipmaps is set
7777
* BamReader now releases the GIL (so it can be used threaded)
7878
* Fix AttributeError in direct.stdpy.threading module
79+
* Fix crash when writing 16-bit .tif file (now silently downsamples)
7980

8081
------------------------ RELEASE 1.9.1 ------------------------
8182

panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,13 +1114,13 @@ write_data(xel *array, xelval *alpha) {
11141114
bytesperrow = _x_size * samplesperpixel;
11151115
} else if ( grayscale ) {
11161116
samplesperpixel = 1;
1117-
bitspersample = pm_maxvaltobits( _maxval );
1117+
bitspersample = min(8, pm_maxvaltobits(_maxval));
11181118
photometric = PHOTOMETRIC_MINISBLACK;
11191119
i = 8 / bitspersample;
11201120
bytesperrow = ( _x_size + i - 1 ) / i;
11211121
} else {
11221122
samplesperpixel = 1;
1123-
bitspersample = 8;
1123+
bitspersample = min(8, pm_maxvaltobits(_maxval));
11241124
photometric = PHOTOMETRIC_PALETTE;
11251125
bytesperrow = _x_size;
11261126
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy