layeredimage/io/layered.py
def writeImage_LAYERED(image: Image.Image, zipFile: ZipFile, path: str, compressed: bool = False):
	"""Write an image to the archive."""
	imgByteArr = io.BytesIO()
	imageCopy = image.copy()
	if compressed and len(set(imageCopy.getcolors(maxcolors=256 ** 3))) < 256:
		imageCopy = imageCopy.quantize(colors=256, method=2, kmeans=1)
	imageCopy.save(imgByteArr, format="PNG", optimize=compressed)
	imgByteArr.seek(0)
	zipFile.writestr(path, imgByteArr.read())
Write an image to the archive.
Write an image to the archive.
Write an image to the archive .
def writeImage_LAYERED(image: Image.Image, zipFile: ZipFile, path: str, compressed: bool = False):
	imgByteArr = io.BytesIO()
	imageCopy = image.copy()
	if compressed and len(set(imageCopy.getcolors(maxcolors=256 ** 3))) < 256:
		imageCopy = imageCopy.quantize(colors=256, method=2, kmeans=1)
	imageCopy.save(imgByteArr, format="PNG", optimize=compressed)
	imgByteArr.seek(0)
	zipFile.writestr(path, imgByteArr.read())
def writeImage_LAYERED ( image : Image . Image , zipFile : ZipFile , path : str , compressed : bool = False ) : imgByteArr = io . BytesIO ( ) imageCopy = image . copy ( ) if compressed and len ( set ( imageCopy . getcolors ( maxcolors = 256 ** 3 ) ) ) < 256 : imageCopy = imageCopy . quantize ( colors = 256 , method = 2 , kmeans = 1 ) imageCopy . save ( imgByteArr , format = "PNG" , optimize = compressed ) imgByteArr . seek ( 0 ) zipFile . writestr ( path , imgByteArr . read ( ) )
Write an image to the archive.
Write an image to the archive .
"""Write an image to the archive."""
image
Image.Image
zipFile
ZipFile
path
str
compressed
bool