layeredimage/io/ora.py
def openLayer_ORA(file: str) -> LayeredImage:
	"""Open an .ora file into a layered image."""
	from pyora import TYPE_LAYER, Project

	blendLookup = {
		"svg:src-over": BlendType.NORMAL,
		"svg:multiply": BlendType.MULTIPLY,
		"svg:color-burn": BlendType.COLOURBURN,
		"svg:color-dodge": BlendType.COLOURDODGE,
		"svg:": BlendType.REFLECT,
		"svg:overlay": BlendType.OVERLAY,
		"svg:difference": BlendType.DIFFERENCE,
		"svg:lighten": BlendType.LIGHTEN,
		"svg:darken": BlendType.DARKEN,
		"svg:screen": BlendType.SCREEN,
		"svg:hard-light": BlendType.HARDLIGHT,
		"svg:soft-light": BlendType.SOFTLIGHT,
		"svg:hue": BlendType.HUE,
		"svg:saturation": BlendType.SATURATION,
		"svg:color": BlendType.COLOUR,
		"svg:luminosity": BlendType.LUMINOSITY,
		"svg:plus": BlendType.ADDITIVE,
		"svg:dst-in": BlendType.DESTIN,
		"svg:dst-out": BlendType.DESTOUT,
		"svg:dst-atop": BlendType.DESTATOP,
		"svg:src-atop": BlendType.SRCATOP,
	}
	layersAndGroups = []
	project = Project.load(file)
	for layerOrGroup in project.children[::-1]:
		if layerOrGroup.type == TYPE_LAYER:
			layersAndGroups.append(
				Layer(
					layerOrGroup.name,
					layerOrGroup.get_image_data(True),
					layerOrGroup.dimensions,
					layerOrGroup.offsets,
					layerOrGroup.opacity,
					layerOrGroup.visible,
					blendModeLookup(layerOrGroup.composite_op, blendLookup),
				)
			)
		else:
			layers = []
			for layer in list(layerOrGroup.children)[::-1]:
				layers.append(
					Layer(
						layer.name,
						layer.get_image_data(True),
						layer.dimensions,
						layer.offsets,
						layer.opacity,
						layer.visible,
						blendModeLookup(layerOrGroup.composite_op, blendLookup),
					)
				)
			layersAndGroups.append(
				Group(
					layerOrGroup.name,
					layers,
					project.dimensions,
					layerOrGroup.offsets,
					layerOrGroup.opacity,
					layerOrGroup.visible,
					blendModeLookup(layerOrGroup.composite_op, blendLookup),
				)
			)
	return LayeredImage(layersAndGroups, project.dimensions)
Open an .ora file into a layered image.
Open an .ora file into a layered image.
Open an . ora file into a layered image .
def openLayer_ORA(file: str) -> LayeredImage:
	from pyora import TYPE_LAYER, Project
	blendLookup = {
		"svg:src-over": BlendType.NORMAL,
		"svg:multiply": BlendType.MULTIPLY,
		"svg:color-burn": BlendType.COLOURBURN,
		"svg:color-dodge": BlendType.COLOURDODGE,
		"svg:": BlendType.REFLECT,
		"svg:overlay": BlendType.OVERLAY,
		"svg:difference": BlendType.DIFFERENCE,
		"svg:lighten": BlendType.LIGHTEN,
		"svg:darken": BlendType.DARKEN,
		"svg:screen": BlendType.SCREEN,
		"svg:hard-light": BlendType.HARDLIGHT,
		"svg:soft-light": BlendType.SOFTLIGHT,
		"svg:hue": BlendType.HUE,
		"svg:saturation": BlendType.SATURATION,
		"svg:color": BlendType.COLOUR,
		"svg:luminosity": BlendType.LUMINOSITY,
		"svg:plus": BlendType.ADDITIVE,
		"svg:dst-in": BlendType.DESTIN,
		"svg:dst-out": BlendType.DESTOUT,
		"svg:dst-atop": BlendType.DESTATOP,
		"svg:src-atop": BlendType.SRCATOP,
	}
	layersAndGroups = []
	project = Project.load(file)
	for layerOrGroup in project.children[::-1]:
		if layerOrGroup.type == TYPE_LAYER:
			layersAndGroups.append(
				Layer(
					layerOrGroup.name,
					layerOrGroup.get_image_data(True),
					layerOrGroup.dimensions,
					layerOrGroup.offsets,
					layerOrGroup.opacity,
					layerOrGroup.visible,
					blendModeLookup(layerOrGroup.composite_op, blendLookup),
				)
			)
		else:
			layers = []
			for layer in list(layerOrGroup.children)[::-1]:
				layers.append(
					Layer(
						layer.name,
						layer.get_image_data(True),
						layer.dimensions,
						layer.offsets,
						layer.opacity,
						layer.visible,
						blendModeLookup(layerOrGroup.composite_op, blendLookup),
					)
				)
			layersAndGroups.append(
				Group(
					layerOrGroup.name,
					layers,
					project.dimensions,
					layerOrGroup.offsets,
					layerOrGroup.opacity,
					layerOrGroup.visible,
					blendModeLookup(layerOrGroup.composite_op, blendLookup),
				)
			)
	return LayeredImage(layersAndGroups, project.dimensions)
def openLayer_ORA ( file : str ) -> LayeredImage : from pyora import TYPE_LAYER , Project blendLookup = { "svg:src-over" : BlendType . NORMAL , "svg:multiply" : BlendType . MULTIPLY , "svg:color-burn" : BlendType . COLOURBURN , "svg:color-dodge" : BlendType . COLOURDODGE , "svg:" : BlendType . REFLECT , "svg:overlay" : BlendType . OVERLAY , "svg:difference" : BlendType . DIFFERENCE , "svg:lighten" : BlendType . LIGHTEN , "svg:darken" : BlendType . DARKEN , "svg:screen" : BlendType . SCREEN , "svg:hard-light" : BlendType . HARDLIGHT , "svg:soft-light" : BlendType . SOFTLIGHT , "svg:hue" : BlendType . HUE , "svg:saturation" : BlendType . SATURATION , "svg:color" : BlendType . COLOUR , "svg:luminosity" : BlendType . LUMINOSITY , "svg:plus" : BlendType . ADDITIVE , "svg:dst-in" : BlendType . DESTIN , "svg:dst-out" : BlendType . DESTOUT , "svg:dst-atop" : BlendType . DESTATOP , "svg:src-atop" : BlendType . SRCATOP , } layersAndGroups = [ ] project = Project . load ( file ) for layerOrGroup in project . children [ : : - 1 ] : if layerOrGroup . type == TYPE_LAYER : layersAndGroups . append ( Layer ( layerOrGroup . name , layerOrGroup . get_image_data ( True ) , layerOrGroup . dimensions , layerOrGroup . offsets , layerOrGroup . opacity , layerOrGroup . visible , blendModeLookup ( layerOrGroup . composite_op , blendLookup ) , ) ) else : layers = [ ] for layer in list ( layerOrGroup . children ) [ : : - 1 ] : layers . append ( Layer ( layer . name , layer . get_image_data ( True ) , layer . dimensions , layer . offsets , layer . opacity , layer . visible , blendModeLookup ( layerOrGroup . composite_op , blendLookup ) , ) ) layersAndGroups . append ( Group ( layerOrGroup . name , layers , project . dimensions , layerOrGroup . offsets , layerOrGroup . opacity , layerOrGroup . visible , blendModeLookup ( layerOrGroup . composite_op , blendLookup ) , ) ) return LayeredImage ( layersAndGroups , project . dimensions )
Open an .ora file into a layered image.
Open an . ora file into a layered image .
"""Open an .ora file into a layered image."""
file
str