MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _load_image

Function _load_image

lib/matplotlib/testing/compare.py:399–406  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

397
398
399def _load_image(path):
400 img = Image.open(path)
401 # In an RGBA image, if the smallest value in the alpha channel is 255, all
402 # values in it must be 255, meaning that the image is opaque. If so,
403 # discard the alpha channel so that it may compare equal to an RGB image.
404 if img.mode != "RGBA" or img.getextrema()[3][0] == 255:
405 img = img.convert("RGB")
406 return np.asarray(img)
407
408
409def compare_images(expected, actual, tol, in_decorator=False):

Callers 2

compare_imagesFunction · 0.85
save_diff_imageFunction · 0.85

Calls 2

openMethod · 0.45
convertMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…