Editor#
- class aioEasyPillow.Editor(image: Union[Image, str, BytesIO, Editor, Canvas])#
Editor class. It does all the editing operations.
- async arc(position: Tuple[float, float], width: float, height: float, start: float, rotation: float, fill: Optional[Union[Tuple[int, int, int], str, int]] = None, color: Optional[Union[Tuple[int, int, int], str, int]] = None, stroke_width: float = 1) Editor#
Draw arc
- Parameters
width (
float) – Width or archeight (
float) – Height of archstart (
float) – Start position of archrotation (
float) – Rotation in degreefill (Union[Tuple[
int,int,int],str,int], optional) – Fill color, by defaultNonecolor (Union[Tuple[
int,int,int],str,int], optional) – Alias of fill, by defaultNonestroke_width (
float, optional) – Stroke width, by default1
- async bar(position: Tuple[float, float], max_width: Union[int, float], height: Union[int, float], percentage: int = 1, fill: Optional[Union[Tuple[int, int, int], str, int]] = None, color: Optional[Union[Tuple[int, int, int], str, int]] = None, outline: Optional[Union[Tuple[int, int, int], str, int]] = None, stroke_width: float = 1, radius: int = 0) Editor#
Draw a progress bar
- Parameters
percentage (
int, optional) – Percentage to fill of the bar, by default 1fill (Union[Tuple[
int,int,int],str,int], optional) – Fill color, by defaultNonecolor (Union[Tuple[
int,int,int],str,int], optional) – Alias of fill, by defaultNoneoutline (Union[Tuple[
int,int,int],str,int], optional) – Outline color, by defaultNonestroke_width (
float, optional) – Stroke width, by default1radius (
int, optional) – Radius of the bar, by default0
- async blend(image: Union[Image, Editor, Canvas], alpha: float = 0.0, on_top: bool = False) Editor#
Blend image into editor image
- async blur(mode: Literal['box', 'gaussian'] = 'gaussian', amount: float = 1) Editor#
Blur image
- Parameters
mode (Literal['box', 'gaussian'], optional) – Blur mode, by default
gaussianamount (
float, optional) – Amount of blur, by default1
- async ellipse(position: Tuple[float, float], width: float, height: float, fill: Optional[Union[Tuple[int, int, int], str, int]] = None, color: Optional[Union[Tuple[int, int, int], str, int]] = None, outline: Optional[Union[Tuple[int, int, int], str, int]] = None, stroke_width: float = 1) Editor#
Draw an ellipse
- Parameters
width (
float) – Width of ellipseheight (
float) – Height of ellipsefill (Union[Tuple[
int,int,int],str,int], optional) – Fill color, by defaultNonecolor (Union[Tuple[
int,int,int],str,int], optional) – Alias of fill, by defaultNoneoutline (Union[Tuple[
int,int,int],str,int], optional) – Outline color, by defaultNonestroke_width (
float, optional) – Stroke width, by default1
- property image_bytes: BytesIO#
Return image bytes
- Returns
Bytes from the image of Editor
- Return type
BytesIO
- async multicolor_text(position: Tuple[float, float], texts: List[Text], space_separated: bool = True, align: Literal['left', 'center', 'right'] = 'left', stroke_width: int = 0, stroke_color: Optional[Union[Tuple[int, int, int], str, int]] = None) Editor#
Draw multicolor text
- Parameters
texts (List[
Text]) – List of textsspace_separated (
bool, optional) – Separate texts with space, by defaultTruealign (Literal['left', 'center', 'right'], optional) – Align texts, by default
'left'stroke_width (
int, optional) – The optional width of the text stroke, by default0. Use this as a default if not all of yourTextclasses have astroke_widthdefined.stroke_color (Union[Tuple[
int,int,int],str,int], optional) – Color to use for the text stroke. Use this as a default if not all of yourTextclasses have astroke_colordefined. If there is nostroke_withset in this function nor in theTextclass its default is thecolorfrom theText
- async paste(image: Union[Image, Editor, Canvas], position: Tuple[float, float] = (0, 0), mask: Optional[Union[Image, Editor]] = None) Editor#
Paste image into editor
- async polygon(coordinates: list, fill: Optional[Union[Tuple[int, int, int], str, int]] = None, color: Optional[Union[Tuple[int, int, int], str, int]] = None, outline: Optional[Union[Tuple[int, int, int], str, int]] = None) Editor#
Draw a polygon
- Parameters
coordinates (
list) – Coordinates to drawfill (Union[Tuple[
int,int,int],str,int], optional) – Fill color, by defaultNonecolor (Union[Tuple[
int,int,int],str,int], optional) – Alias of fill, by defaultNoneoutline (Union[Tuple[
int,int,int],str,int], optional) – Outline color, by defaultNone
- async rectangle(position: Tuple[float, float], width: float, height: float, fill: Optional[Union[Tuple[int, int, int], str, int]] = None, color: Optional[Union[Tuple[int, int, int], str, int]] = None, outline: Optional[Union[Tuple[int, int, int], str, int]] = None, stroke_width: float = 1, radius: int = 0) Editor#
Draw rectangle into image
- Parameters
width (
float) – Width of rectangleheight (
float) – Height of rectanglefill (Union[Tuple[
int,int,int],str,int,], optional) – Fill color, by default Nonecolor (Union[Tuple[
int,int,int],str,int], optional) – Alias of fill, by defaultNoneoutline (
Union[Tuple[:class:`int,int,int],str,int], optional) – Outline color, by defaultNonestroke_width (
float, optional) – Stroke width, by default1radius (
int, optional) – Radius of rectangle, by default0
- async rounded_bar(position: Tuple[float, float], width: Union[int, float], height: Union[int, float], percentage: float, fill: Optional[Union[Tuple[int, int, int], str, int]] = None, color: Optional[Union[Tuple[int, int, int], str, int]] = None, stroke_width: float = 1) Editor#
Draw a rounded bar
- Parameters
position (Tuple[
float,float]) – Position to draw rounded barpercentage (
float) – Percentage to fillfill (Union[Tuple[
int,int,int],str,int], optional) – Fill color, by defaultNonecolor (Union[Tuple[
int,int,int],str,int], optional) – Alias of color, by defaultNonestroke_width (
float, optional) – Stroke width, by default1
- async show()#
Show the image.
- async text(position: Tuple[float, float], text: str, font: Optional[Union[FreeTypeFont, Font]] = None, color: Union[Tuple[int, int, int], str, int] = 'black', align: Literal['left', 'center', 'right'] = 'left', stroke_width: int = 0, stroke_color: Optional[Union[Tuple[int, int, int], str, int]] = None) Editor#
Draw text into image
- Parameters
text (str) – Text to draw
font (Union[
ImageFont.FreeTypeFont,Font], optional) – Font used for text, by defaultNonecolor (Union[Tuple[
int,int,int],str,int], optional) – Color of the font, by default'black'align (Literal['left', 'center', 'right'], optional) – Align text, by default
'left'stroke_width (
int, optional) – The optional width of the text stroke, by default0stroke_color (Union[Tuple[
int,int,int],str,int], optional) – Color to use for the text stroke. Default to thecolorparameter.