goulib.image

image processing with PIL’s ease and skimage’s power

requires:

optional:

Functions

adapt_rgb(func)

Decorator that adapts to RGB(A) images to a gray-scale filter. :param apply_to_rgb: function Function that returns a filtered image from an image-filter and RGB image. This will only be called if the image is RGB-like.

alpha_composite(front, back)

Alpha composite two RGBA images.

alpha_composite_with_color(image[, color])

Alpha composite an RGBA image with a single color image of the specified color and the same size as the original image.

bool2gray(im)

bool2rgb(im[, color0, color1])

cmyk2rgb(cmyk)

convert(a, source, target, **kwargs)

convert an image between modes, eventually using intermediary steps :param a: nparray (x,y,n) containing image :param source: string : key of source image mode in modes :param target: string : key of target image mode in modes

convert_type(data, type)

convert inner format of image :param data: nparray (x,y,n) containing image :param type: target np.type :return: nparray (x,y,n) with new type replaces outdated skimage.util.dtype.convert using https://scikit-image.org/docs/0.24.x/api/skimage.html#utility-functions

disk(radius[, antialias])

dither(image[, method, N])

Quantize a gray image, using dithering.

fig2img(fig)

Convert a Matplotlib figure to a PIL Image in RGBA format and return it

fspecial(name, **kwargs)

mimics the Matlab image toolbox fspecial function http://www.mathworks.com/help/images/ref/fspecial.html?refresh=true

gray2bool(image[, method, N])

Quantize a gray image, using dithering.

gray2rgb(im[, color0, color1])

guessmode(arr)

ind2any(im, palette, dest)

ind2rgb(im, palette)

lab2ind(im[, colors])

convert a Lab image to indexed colors :param a: nparray (x,y,n) containing image :param colors: int number of colors or predefined Palette :ref: http://scikit-learn.org/stable/auto_examples/cluster/plot_color_quantization.html

nchannels(arr)

normalize(a[, newmax, newmin])

palette(im, ncolors[, tol])

extract the color palette of image array (in its own colorspace.

pure_pil_alpha_to_color_v1(image[, color])

Alpha composite an RGBA Image with a specified color.

pure_pil_alpha_to_color_v2(image[, color])

Alpha composite an RGBA Image with a specified color.

quantize(image[, N, L])

Quantize a gray image.

randomize(image[, N, L])

read_pdf(filename, **kwargs)

reads a bitmap graphics on a .pdf file only the first page is parsed

rgb2cmyk(rgb)

rgb2rgba(array)

Classes

Ditherer(name, method)

ErrorDiffusion(name, positions, weights[, wsum])

FloydSteinberg()

Image([data, mode])

Mode(name, nchannels, type, min, max)