MCPcopy Create free account
hub / github.com/Francis-Rings/StableAnimator / load_images_from_folder

Function load_images_from_folder

inference_basic.py:27–37  ·  view source on GitHub ↗
(folder, width, height)

Source from the content-addressed store, hash-verified

25
26
27def load_images_from_folder(folder, width, height):
28 images = []
29 files = os.listdir(folder)
30 png_files = [f for f in files if f.endswith('.png')]
31 png_files.sort(key=lambda x: int(x.split('_')[1].split('.')[0]))
32 for filename in png_files:
33 img = Image.open(os.path.join(folder, filename)).convert('RGB')
34 img = img.resize((width, height))
35 images.append(img)
36
37 return images
38
39def save_frames_as_png(frames, output_path):
40 pil_frames = [Image.fromarray(frame) if isinstance(frame, np.ndarray) else frame for frame in frames]

Callers 1

inference_basic.pyFile · 0.70

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected