layeredimage/io/lsr.py
def saveLayer_LSR(fileName: str, layeredImage: LayeredImage) -> None:
	"""Save a layered image as .lsr."""
	import pylsr

	layers = []
	for group in layeredImage.layersAndGroups:
		if isinstance(group, Layer):
			imageData = [pylsr.LSRImageData(group.image, group.name)]
		else:
			imageData = [
				pylsr.LSRImageData(
					renderWAlphaOffset(layer.image, group.dimensions, layer.opacity, layer.offsets),
					layer.name,
				)
				for layer in group.layers
			]
		layers.append(
			pylsr.LSRLayer(
				imageData,
				group.name,
				group.dimensions,
				(
					group.offsets[0] + group.dimensions[0] // 2,
					group.offsets[1] + group.dimensions[1] // 2,
				),
			)
		)
	lsrImage = pylsr.LSRImage(
		layeredImage.dimensions, fileName.split(sep)[-1].replace(".lsr", ""), layers
	)
	pylsr.write(fileName, lsrImage)
Save a layered image as .lsr.
Save a layered image as .lsr.
Save a layered image as . lsr .
def saveLayer_LSR(fileName: str, layeredImage: LayeredImage) -> None:
	import pylsr
	layers = []
	for group in layeredImage.layersAndGroups:
		if isinstance(group, Layer):
			imageData = [pylsr.LSRImageData(group.image, group.name)]
		else:
			imageData = [
				pylsr.LSRImageData(
					renderWAlphaOffset(layer.image, group.dimensions, layer.opacity, layer.offsets),
					layer.name,
				)
				for layer in group.layers
			]
		layers.append(
			pylsr.LSRLayer(
				imageData,
				group.name,
				group.dimensions,
				(
					group.offsets[0] + group.dimensions[0] // 2,
					group.offsets[1] + group.dimensions[1] // 2,
				),
			)
		)
	lsrImage = pylsr.LSRImage(
		layeredImage.dimensions, fileName.split(sep)[-1].replace(".lsr", ""), layers
	)
	pylsr.write(fileName, lsrImage)
def saveLayer_LSR ( fileName : str , layeredImage : LayeredImage ) -> None : import pylsr layers = [ ] for group in layeredImage . layersAndGroups : if isinstance ( group , Layer ) : imageData = [ pylsr . LSRImageData ( group . image , group . name ) ] else : imageData = [ pylsr . LSRImageData ( renderWAlphaOffset ( layer . image , group . dimensions , layer . opacity , layer . offsets ) , layer . name , ) for layer in group . layers ] layers . append ( pylsr . LSRLayer ( imageData , group . name , group . dimensions , ( group . offsets [ 0 ] + group . dimensions [ 0 ] // 2 , group . offsets [ 1 ] + group . dimensions [ 1 ] // 2 , ) , ) ) lsrImage = pylsr . LSRImage ( layeredImage . dimensions , fileName . split ( sep ) [ - 1 ] . replace ( ".lsr" , "" ) , layers ) pylsr . write ( fileName , lsrImage )
Save a layered image as .lsr.
Save a layered image as . lsr .
"""Save a layered image as .lsr."""
fileName
str
layeredImage
LayeredImage