Imageedit Index / Imageedit / Effects
Auto-generated documentation for imageedit.effects module.
From https://en.wikibooks.org/wiki/Python_Imaging_Library/Drop_Shadows.
imageImage.Image - Base image to give a drop shadowiterationsint - Number of times to apply the blur filter to the shadowborderint - Border to give the image to leave space for the shadow offset (list[int, int]): Offset of the shadow as [x,y]backgroundColourstr - Colour of the backgroundshadowColourstr - Colour of the drop shadow
Image.Image- A PIL Image
def addDropShadowComplex(
image: Image.Image,
iterations: int,
border: int,
offset: list[int],
backgroundColour: str,
shadowColour: str,
) -> Image.Image: ...Add a simple drop shadow.
imageImage.Image - Base image to give a drop shadow offset (list[int, int]): Offset of the shadow as [x,y]
Image.Image- A PIL Image
def addDropShadowSimple(image: Image.Image, offset: list[int]) -> Image.Image: ...Add text to an image such that the resultant image is in the form [img]|text. The text is in fira code and has a maximum length of 16 chars (text longer than this is truncated with "...")
imageImage.Image - A PIL Image to add text totextstr - A string containing text to add to the image
Image.Image- Image with text
def addText(image: Image.Image, text: str) -> Image.Image: ...Apply a swatch to the image using colourswatch.
imageImage.Image - The PIL ImageswatchFilestring - Path to the swatch file
Image- quantized image
def applySwatch(image, swatchFile): ...Blend layers using numpy array.
backgroundImage.Image - background layerforegroundImage.Image - foreground layer (must be same size as background)blendTypeBlendType - The blendtypeopacityfloat - The opacity of the foreground image
Image- combined image
Specify supported blend types NORMAL MULTIPLY ADDITIVE COLOURBURN COLOURDODGE REFLECT GLOW OVERLAY DIFFERENCE NEGATION LIGHTEN DARKEN SCREEN XOR SOFTLIGHT HARDLIGHT GRAINEXTRACT GRAINMERGE DIVIDE HUE SATURATION COLOUR LUMINOSITY PINLIGHT VIVIDLIGHT EXCLUSION DESTIN DESTOUT DESTATOP SRCATOP
def blend(
background: Image.Image,
foreground: Image.Image,
blendType: BlendType,
opacity: float = 1,
) -> Image.Image: ...Convert a PIL Image to black and white from a colour image.
Some implementations use numpy but im not going to include the extra import
imageImage.Image - A PIL Image to act onmodestr, optional - Any of ["filter-darker", "filter-lighter", "background", "foreground", "edges"] Specify the mode for the function to use. filter-darker and lighter respectively make pixels darker than the average black and pixels that are lighter than the average black. background sets the most dominant colour to white and foreground sets the second most dominant color to black. edges finds the edges and sets them to black. non edges are white. Defaults to "filter-darker".
Image.Image- The black and white image
def convertBlackAndWhite(image: Image.Image, mode: str = "filter-darker"): ...Low level function
Convert an image to black and white based on the foreground/ background: background sets the most dominant colour to white and foreground sets the second most dominant color to black.
imageImage.Image - A PIL Image to act onmodestr - background sets the most dominant colour to white and foreground sets the second most dominant color to black.
Image.Image- The black and white image
def doConvertBlackAndWhiteBGFG(image, mode): ...Low level function
Convert an image to black and white based on a filter: filter-darker and lighter respectively make pixels darker than the average black and pixels that are lighter than the average black.
imageImage.Image - A PIL Image to act onmodestr - filter-darker and lighter respectively make pixels darker than the average black and pixels that are lighter than the average black.
Image.Image- The black and white image
def doConvertBlackAndWhiteFilter(image: Image.Image, mode: str): ...Apply a pixelate effect to an image. This might be used to create a retro effect.
imageImage.Image - A pillow imagepixelSizeint, optional - X, Y pixels to merge. E.g. assuming image dimensions of 256x256 and pixelSize of 4, an image with dimensions 256x256 will be returned with the effect of an image with size 64x64. Defaults to 4.
Image- pixelated image
def pixelate(image: Image.Image, pixelSize: int = 4): ...Remove the background from an image or a layeredimage.
imageImage.Image|layeredimage.layeredimage.LayeredImage - An image or a layered image
Image- image without bg
def removeBG(image: Image.Image): ...Round the corners by a number of pixels. May be preferable to use
roundCornersAntiAlias. Use with caution as it modifies the image param. radius can be one of the following: pixel: int, percent: "val%", scale: "valx"
imageImage.Image - A PIL Imageradiusint,str - One of pixel, percent, scale
Image.Image- A PIL Image
def roundCorners(image: Image.Image, radius: int | str) -> Image.Image: ...Round Corners taking a radius int as an arg and do antialias.
imageImage.Image - A PIL Imageradiusint - radius in px
Image.Image- Image
def roundCornersAntiAlias(image: Image.Image, radius: int) -> Image.Image: ...