mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-30 23:47:27 +03:00 
			
		
		
		
	Merge pull request #3417 from kkopachev/issue-3413
Only ask for YCbCr->RGB libtiff conversion for jpeg-compressed tiffs
This commit is contained in:
		
						commit
						a2908734f3
					
				|  | @ -173,6 +173,7 @@ int ImagingLibTiffDecode(Imaging im, ImagingCodecState state, UINT8* buffer, int | ||||||
|     char *filename = "tempfile.tif"; |     char *filename = "tempfile.tif"; | ||||||
|     char *mode = "r"; |     char *mode = "r"; | ||||||
|     TIFF *tiff; |     TIFF *tiff; | ||||||
|  |     uint16 photometric = 0, compression; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     /* buffer is the encoded file, bytes is the length of the encoded file */ |     /* buffer is the encoded file, bytes is the length of the encoded file */ | ||||||
|  | @ -234,7 +235,12 @@ int ImagingLibTiffDecode(Imaging im, ImagingCodecState state, UINT8* buffer, int | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     TIFFGetFieldDefaulted(tiff, TIFFTAG_COMPRESSION, &compression); | ||||||
|  |     TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &photometric); | ||||||
|  |     if (compression == COMPRESSION_JPEG && photometric == PHOTOMETRIC_YCBCR) { | ||||||
|  |         /* Set pseudo-tag to force automatic YCbCr->RGB conversion */ | ||||||
|         TIFFSetField(tiff, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB); |         TIFFSetField(tiff, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB); | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     if (TIFFIsTiled(tiff)) { |     if (TIFFIsTiled(tiff)) { | ||||||
|         uint32 x, y, tile_y; |         uint32 x, y, tile_y; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user