module imghelper.img_helper

Short summary

module pyquickhelper.imghelper.img_helper

Helpers around images.

source on GitHub

Functions

function

truncated documentation

_optimization_criterion

_optimization_histogram_order

concat_images

Concatenates images into an image with several rows of images.

white_to_transparency

Sets white color as transparency color.

zoom_img

Zooms an image.

Documentation

Helpers around images.

source on GitHub

pyquickhelper.imghelper.img_helper._optimization_criterion(target, data, weight_above=10, weight_below=1)[source]
pyquickhelper.imghelper.img_helper._optimization_histogram_order(target, data, weight_above=10, weight_below=1)[source]
pyquickhelper.imghelper.img_helper.concat_images(imgs, height=200, width=800, weight_above=10, weight_below=1, background=(0, 0, 0), out_file=None)[source]

Concatenates images into an image with several rows of images.

Parameters
  • imgs – filename or Images (Pillow)

  • height – height of each row (pixels)

  • width – width of each row (pixels)

  • weight_above – loss when a line is too long

  • weight_below – loss when a line is too short

  • background – background color

  • out_file – stores the image into this file if not None

Returns

Image (Pillow)

source on GitHub

pyquickhelper.imghelper.img_helper.white_to_transparency(img, out_file=None)[source]

Sets white color as transparency color.

Parameters
  • img – image (Pillow)

  • out_file – stores the image into this file if not None

Returns

image (Pillow)

Code taken from Using PIL to make all white pixels transparent?.

source on GitHub

pyquickhelper.imghelper.img_helper.zoom_img(img, factor=1.0, max_dim=None, out_file=None, fLOG=None)[source]

Zooms an image.

Parameters
  • img – image or filename or pattern

  • factor – multiplies the image by this factor if not None

  • max_dim – modifies the image, the highest dimension should below this number

  • out_file – stores the image into this file if not None

  • fLOG – logging function

Returns

image

source on GitHub