jinks_core.draw

Create a custom JinksImageDraw class that overlaps ImageDraw from PIL to add commonly used methods.

Classes

JinksDraw(im[, mode])

Custom drawing class.

class jinks_core.draw.JinksDraw(im, mode=None)

Bases: ImageDraw

Custom drawing class.

__init__(im, mode=None)

Initialize the custom draw object.

borders(width=1, color='black', margin=0, style='solid')

Draw borders around the image or with margin.

Parameters:
  • width (int) – Border thickness

  • color (str | tuple[int, int, int]) – Border color

  • margin (int) – Distance from image edge

  • style (str) – ‘solid’, ‘dashed’, or ‘rounded’

Return type:

None

draw_error(fill_color=170, radius=20)

Draw a grey filled rounded rectangle covering the entire image.

Parameters:
  • fill_color (int) – Fill color for the error rectangle (default: grey)

  • radius (int) – Corner radius for the rounded rectangle (default: 10)

Return type:

None

rounded_rectangle_with_missing_sides(xy, width, height, radius=10, outline='black', width_outline=1, show_top=True, show_bottom=True, show_left=True, show_right=True)

Draw a rounded rectangle with the ability to hide specific sides.

Corners are only rounded if both adjacent sides are visible.