Imageedit Index / Imageedit / Transform
Auto-generated documentation for imageedit.transform module.
Show source in transform.py:14
Crops the centre part of the image with a width and height.
width, height can be one of the following: pixel: int, percent: "val%", scale: "valx"
imageImage.Image - Input imagewidthint,str - One of pixel, percent, scaleheightint,str - One of pixel, percent, scale
Image.Image- A PIL Image
def cropCentre(
image: Image.Image, width: int | str, height: int | str
) -> Image.Image: ...Show source in transform.py:42
Uncrops the image with a padding. padding can be one of the following: pixel: int, percent: "val%", scale: "valx"
imageImage.Image - Input imagepaddingint,str - One of pixel, percent, scale
Image.Image- A PIL Image
def expand(image: Image.Image, padding: int | str) -> Image.Image: ...Show source in transform.py:131
Find and replace colour in PIL Image.
imageImage.Image - The Imagefind(r,g,b,a) - A tuple containing values for rgba from 0-255 inclusivereplace(r,g,b,a) - A tuple containing values for rgba from 0-255 inclusivenoMatch(r,g,b,a), optional - A tuple containing values for rgba from 0-255 inclusive. Set pixel colour if not matched. Default is Nonethresholdint, optional - Find and replace without an exact match. Default is 5
Image.Image- The result
def findAndReplace(
image: Image.Image,
find: Iterable[int],
replace: Iterable[int],
noMatch: Iterable[int] | None = None,
threshold: int = 5,
) -> Image.Image: ...Show source in transform.py:115
Take an image and preforms a centre crop and removes the padding.
imageImage.Image - Imagepaddingint - padding in px
Image.Image- Image
def removePadding(image: Image.Image, padding: int) -> Image.Image: ...Show source in transform.py:75
Resize an image with desired dimensions. This is most suitable for resizing non square images where a factor would not be sufficient. width, height can be one of the following: pixel: int, percent: "val%", scale: "valx"
imageImage.Image - A PIL Imagewidthint,str - One of pixel, percent, scaleheightint,str - One of pixel, percent, scale
Image.Image- Image
def resize(image: Image.Image, width: int | str, height: int | str) -> Image.Image: ...Show source in transform.py:96
Resize a square image. Or make a non square image square (will stretch if input image is non-square) size can be one of the following: pixel: int, percent: "val%", scale: "valx"
imageImage.Image - A PIL Imagesizeint,str - One of pixel, percent, scale
Image.Image- Image
def resizeSquare(image: Image.Image, size: int | str) -> Image.Image: ...