| |
- AreEqual(image1, image2, tolerance=0, likely_equal=True)
- Determines whether two images are identical within a given tolerance.
Setting likely_equal to False enables short-circuit equality testing, which
is about 2-3x slower for equal images, but can be image height times faster
if the images are not equal.
- Channels(image)
- Number of color channels in the image.
- Crop(image, left, top, width, height)
- Crops the current image down to the specified box.
- Diff(image1, image2)
- Returns a new image that represents the difference between this image
and another image.
- FromBase64Png(base64_png)
- Create an image from raw PNG data encoded in base64.
- FromPng(png_data)
- Create an image from raw PNG data.
- FromPngFile(path)
- Create an image from a PNG file.
Args:
path: The path to the PNG file.
- FromRGBPixels(width, height, pixels, bpp=3)
- Create an image from an array of rgb pixels.
Ignores alpha channel if present.
Args:
width, height: int, the width and height of the image.
pixels: The flat array of pixels in the form of [r,g,b[,a],r,g,b[,a],...]
bpp: 3 for RGB, 4 for RGBA.
- GetBoundingBox(image, color, tolerance=0)
- Finds the minimum box surrounding all occurrences of bgr |color|.
Ignores the alpha channel.
Args:
color: RbgaColor, bounding box color.
tolerance: int, per-channel tolerance for the bounding box color.
Returns:
(top, left, width, height), match_count
- GetColorHistogram(image, ignore_color=None, tolerance=0)
- Computes a histogram of the pixel colors in this image.
Args:
ignore_color: An RgbaColor to exclude from the bucket counts.
tolerance: A tolerance for the ignore_color.
Returns:
A ColorHistogram namedtuple with 256 integers in each field: r, g, and b.
- GetPixelColor(image, x, y)
- Returns a RgbaColor for the pixel at (x, y).
- Height(image)
- Height of the image.
- Pixels(image)
- Flat RGB pixel array of the image.
- Width(image)
- Width of the image.
- WritePngFile(image, path)
- Write an image to a PNG file.
Args:
image: an image object.
path: The path to the PNG file. Must end in 'png' or an
AssertionError will be raised.
|