Skip to content

Latest commit

 

History

History
249 lines (146 loc) · 4.54 KB

File metadata and controls

249 lines (146 loc) · 4.54 KB

Io

Imageedit Index / Imageedit / Io

Auto-generated documentation for imageedit.io module.

Attributes

checkExists

Show source in io.py:207

Throw an error and abort if the path does not exist.

Signature

def checkExists(file): ...

combine

Show source in io.py:188

Combine two images with alpha.

Signature

def combine(
    foregroundImage,
    backgroundImage,
    foregroundOffsets=(0, 0),
    backgroundOffsets=(0, 0),
    foregroundAlpha=1.0,
    backgroundAlpha=1.0,
): ...

getContrastRatio

Show source in io.py:214

Get the contrast ratio of an image

Signature

def getContrastRatio(image: Image.Image) -> float: ...

getImageDesc

Show source in io.py:130

Get an image description returns [icon/mask]. Likely more useful for my specific use case than in the general lib.

Arguments


  • image PIL.Image.Image - Image

Returns


  • str - description of image

Signature

def getImageDesc(image: Image.Image) -> str: ...

getPixelDimens

Show source in io.py:40

Get the pixel dimensions for an image from one of the following.

pixel (no calculation): int, percent: "val%", scale: "valx"

Arguments


  • image Image.Image - Input image
  • dimens int|str - One of pixel, percent, scale

Returns


  • list[int] - outDimens in pixels

Signature

def getPixelDimens(image: Image.Image, dimens: list[int | str]) -> list[int]: ...

getSortedColours

Show source in io.py:151

Get the list of colours in an image sorted by 'popularity'.

Arguments


  • image PIL.Image.Image - Image to get colours from

Returns


  • (colour_count, colour)[] - list of tuples in the form pixel_count, colour

Signature

def getSortedColours(
    image: Image.Image,
) -> list[tuple[int, tuple[int, int, int, int]]]: ...

openImage

Show source in io.py:91

Open a single image and returns an image object.

Use full file path or file path relative to /lib

Arguments


  • file str - full file path or file path relative to /lib
  • mode str,None - open image with a mode (optional)

Returns


  • Image.Image - Image

Signature

def openImage(file: str, mode: str | None = None) -> Image.Image: ...

openImagesInDir

Show source in io.py:71

Open all images in a directory and returns them in a list along with filepath.

Arguments


  • dirGlob str - in the form "input/*."
  • mode str,None - open image with a mode (optional)

Returns


  • PIL.Image.Image - Image

Signature

def openImagesInDir(
    dirGlob: str, mode: str | None = None
) -> list[tuple[str, Image.Image]]: ...

reduceColours

Show source in io.py:170

Reduces the number of colours in an image. Modes "logo", "optimised".

Arguments


  • image PIL.Image.Image - Input image
  • mode str, optional - Mode "logo" or "optimised". Defaults to "optimised".

Returns


  • PIL.Image.Image - A PIL Image

Signature

def reduceColours(image: Image.Image, mode: str = "optimised"): ...

saveImage

Show source in io.py:114

Save a single image.

Use full file path or file path relative to /lib. Pass in the image object

Arguments


  • fileName string - full file path or file path relative to /lib
  • image PIL.Image.Image - A PIL Image

Signature

def saveImage(fileName, image): ...