MCPcopy Index your code
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / save_image

Function save_image

pix2pix/util/util.py:47–66  ·  view source on GitHub ↗

Save a numpy image to the disk Parameters: image_numpy (numpy array) -- input numpy array image_path (str) -- the path of the image

(image_numpy, image_path, aspect_ratio=1.0)

Source from the content-addressed store, hash-verified

45
46
47def save_image(image_numpy, image_path, aspect_ratio=1.0):
48 """Save a numpy image to the disk
49
50 Parameters:
51 image_numpy (numpy array) -- input numpy array
52 image_path (str) -- the path of the image
53 """
54 image_pil = Image.fromarray(image_numpy)
55
56 image_pil = image_pil.convert('I;16')
57
58 # image_pil = Image.fromarray(image_numpy)
59 # h, w, _ = image_numpy.shape
60 #
61 # if aspect_ratio > 1.0:
62 # image_pil = image_pil.resize((h, int(w * aspect_ratio)), Image.BICUBIC)
63 # if aspect_ratio < 1.0:
64 # image_pil = image_pil.resize((int(h / aspect_ratio), w), Image.BICUBIC)
65
66 image_pil.save(image_path)
67
68
69def print_numpy(x, val=True, shp=False):

Callers

nothing calls this directly

Calls 1

saveMethod · 0.45

Tested by

no test coverage detected