ShrinkRay/docs/convert.md

3.8 KiB

module convert


function getNewPixels

getNewPixels(baseImage: ImageFile | str, newImage: ImageFile | str)  list

Compare two images and return the pixels that are different in the second image as an ImageFile and the corresponding bounding box


function toPBytes

toPBytes(im: ImageFile, index: list = [])  list

Convert an ImageFile to bitflip array bytes, here referred to as pBytes or pixel bytes, then return the index


function fromPBytes

fromPBytes(pBytes: bytes)  list

Convert bitflip array into pixels then return the 1 dimensional list of pixels


function loadHexPalette

loadHexPalette(palette: str)  list

Load hex palette from the file at the path passed in by the palette parameter, convert it to an RGB index and return the index


function toSR

toSR(imPath: str, outPath: str, scale: int = 1, palette: int | bool = False)

Convert the image at imPath to an SR at outPath, optionally accepting a scaling factor for rendering and a predefined palette to use instead of auto building one


function toSRB

toSRB(
    framesGlob: str,
    outPath: str,
    scale: int = 1,
    frameOffsetMS: int = -1
)  None

Convert the frames at framesGlob to an SRB at outPath, with an optional scaling factor and frame offset


function toStill

toStill(srPath, outPath, palette: bool | str = False)  None

Convert SR file to still image, optionally provide a palette for palette dependent files or for palette swapping


function toAnimation

toAnimation(
    srlPath,
    outPath,
    format: str | bool = False,
    outputFrames: bool = True
)

Write SRB frames to disk as either a set of files or a single animated webp or gif


This file was automatically generated via lazydocs.