ShrinkRay/docs/convert.md

130 lines
3.8 KiB
Markdown
Raw Permalink Normal View History

2024-08-27 23:43:58 +00:00
<!-- markdownlint-disable -->
<a href="https://git.utopic.work/PierMesh/ShrinkRay/src/branch/main/src/convert.py#L0"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
# <kbd>module</kbd> `convert`
---
<a href="https://git.utopic.work/PierMesh/ShrinkRay/src/branch/main/src/convert.py#L20"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
## <kbd>function</kbd> `getNewPixels`
```python
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
---
<a href="https://git.utopic.work/PierMesh/ShrinkRay/src/branch/main/src/convert.py#L44"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
## <kbd>function</kbd> `toPBytes`
```python
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
---
<a href="https://git.utopic.work/PierMesh/ShrinkRay/src/branch/main/src/convert.py#L70"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
## <kbd>function</kbd> `fromPBytes`
```python
fromPBytes(pBytes: bytes) → list
```
Convert bitflip array into pixels then return the 1 dimensional list of pixels
---
<a href="https://git.utopic.work/PierMesh/ShrinkRay/src/branch/main/src/convert.py#L91"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
## <kbd>function</kbd> `loadHexPalette`
```python
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
---
<a href="https://git.utopic.work/PierMesh/ShrinkRay/src/branch/main/src/convert.py#L103"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
## <kbd>function</kbd> `toSR`
```python
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
---
<a href="https://git.utopic.work/PierMesh/ShrinkRay/src/branch/main/src/convert.py#L135"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
## <kbd>function</kbd> `toSRB`
```python
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
---
<a href="https://git.utopic.work/PierMesh/ShrinkRay/src/branch/main/src/convert.py#L156"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
## <kbd>function</kbd> `toStill`
```python
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
---
<a href="https://git.utopic.work/PierMesh/ShrinkRay/src/branch/main/src/convert.py#L191"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
## <kbd>function</kbd> `toAnimation`
```python
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](https://github.com/ml-tooling/lazydocs)._