mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	Merge pull request #4866 from radarhere/cmyk_pdf
Corrected inverted PDF CMYK colors
This commit is contained in:
		
						commit
						855a28e544
					
				| 
						 | 
					@ -121,6 +121,7 @@ def _save(im, fp, filename, save_all=False):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            bits = 8
 | 
					            bits = 8
 | 
				
			||||||
            params = None
 | 
					            params = None
 | 
				
			||||||
 | 
					            decode = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if im.mode == "1":
 | 
					            if im.mode == "1":
 | 
				
			||||||
                filter = "ASCIIHexDecode"
 | 
					                filter = "ASCIIHexDecode"
 | 
				
			||||||
| 
						 | 
					@ -150,6 +151,7 @@ def _save(im, fp, filename, save_all=False):
 | 
				
			||||||
                filter = "DCTDecode"
 | 
					                filter = "DCTDecode"
 | 
				
			||||||
                colorspace = PdfParser.PdfName("DeviceCMYK")
 | 
					                colorspace = PdfParser.PdfName("DeviceCMYK")
 | 
				
			||||||
                procset = "ImageC"  # color images
 | 
					                procset = "ImageC"  # color images
 | 
				
			||||||
 | 
					                decode = [1, 0, 1, 0, 1, 0, 1, 0]
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                raise ValueError("cannot save mode %s" % im.mode)
 | 
					                raise ValueError("cannot save mode %s" % im.mode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -189,6 +191,7 @@ def _save(im, fp, filename, save_all=False):
 | 
				
			||||||
                Height=height,  # * 72.0 / resolution,
 | 
					                Height=height,  # * 72.0 / resolution,
 | 
				
			||||||
                Filter=PdfParser.PdfName(filter),
 | 
					                Filter=PdfParser.PdfName(filter),
 | 
				
			||||||
                BitsPerComponent=bits,
 | 
					                BitsPerComponent=bits,
 | 
				
			||||||
 | 
					                Decode=decode,
 | 
				
			||||||
                DecodeParams=params,
 | 
					                DecodeParams=params,
 | 
				
			||||||
                ColorSpace=colorspace,
 | 
					                ColorSpace=colorspace,
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user