Skip to content

Latest commit

 

History

History
304 lines (188 loc) · 5.42 KB

index.md

File metadata and controls

304 lines (188 loc) · 5.42 KB

Pylsr

Pylsr Index / Pylsr

Auto-generated documentation for pylsr module.

LSRImage

Show source in init.py:17

LSRImage contains data on the overall size, the layers and the name of the lsr image.

Signature

class LSRImage:
    def __init__(
        self, size: tuple[int, int], name: str, layers: list[LSRLayer] | None = None
    ) -> None: ...

LSRImage().flatten

Show source in init.py:25

Flatten all of the layers.

Signature

def flatten(self) -> Image.Image: ...

LSRImageData

Show source in init.py:69

LSRImageData stores the PIL Image along with the name, scale of the image and the idiom.

Signature

class LSRImageData:
    def __init__(
        self,
        image: Image.Image,
        name: str,
        scale: str = "1x",
        idiom: str = "universal",
        offsets: tuple[int, int] = (0, 0),
    ) -> None: ...

LSRImageData().scaledImage

Show source in init.py:86

Get the scaled image.

Returns

Image.Image: The image to scale

Signature

def scaledImage(self): ...

LSRLayer

Show source in init.py:33

LSRLayer contains data on the layer such as the list of images, the name, the size and the centre offset.

Signature

class LSRLayer:
    def __init__(
        self,
        images: list[LSRImageData],
        name: str,
        size: tuple[int, int],
        center: tuple[int, int],
    ) -> None: ...

See also

LSRLayer().flatten

Show source in init.py:64

Flatten all of the layers.

Signature

def flatten(self) -> Image.Image: ...

LSRLayer().offsets

Show source in init.py:50

Calculate the x, y offset for the top left corner.

Returns

tuple[int, int]: tuple for x, y offset

Signature

def offsets(self) -> tuple[int, int]: ...

flattenAll

Show source in init.py:253

Flatten a list of layers and groups.

Arguments


  • layers list[LSRImageData] - A list of layers and groups imageDimensions (tuple[int, int]): size of the image been flattened. Defaults to None.

Returns


  • Image.Image - Flattened image

Signature

def flattenAll(
    layers: list[LSRImageData], imageDimensions: tuple[int, int]
) -> Image.Image: ...

See also

flattenTwoLayers

Show source in init.py:228

Flatten two layers of an image.

Arguments


  • layer LSRImageData - lsrimagedata imageDimensions (tuple[int, int]): a tuple of the image dimensions
  • flattenedSoFar Image.Image, optional - Render of what has already been flattened. Defaults to None.

Returns


  • Image.Image - Flattened image

Signature

def flattenTwoLayers(
    layer: LSRImageData,
    imageDimensions: tuple[int, int],
    flattenedSoFar: Image.Image | None = None,
) -> Image.Image: ...

See also

jsonLoadsFromArchive

Show source in init.py:13

Signature

def jsonLoadsFromArchive(x): ...

rasterImageOffset

Show source in init.py:275

Render an image with offset to a given size. (deprecated, use renderImageOffset).

Signature

@deprecated(deprecated_in="2022", removed_in="2023", details="Use renderImageOffset")
def rasterImageOffset(
    image: Image.Image, size: tuple[int, int], offsets: tuple[int, int] = (0, 0)
) -> Image.Image: ...

read

Show source in init.py:98

Read an lsr file.

Arguments


  • filename str - the path to the file

Returns


  • LSRImage - An lsr image representation

Signature

def read(filename: str) -> LSRImage: ...

See also

renderImageOffset

Show source in init.py:283

Render an image with offset to a given size.

Signature

def renderImageOffset(
    image: Image.Image, size: tuple[int, int], offsets: tuple[int, int] = (0, 0)
) -> Image.Image: ...

write

Show source in init.py:159

Write an lsr image to disk.

Arguments


  • filename str - filename and extension
  • lsrImage LSRImage - the lsr image representation to save

Signature

def write(filename: str, lsrImage: LSRImage) -> None: ...

See also