File size: 1,228 Bytes
3de264f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from PIL import Image
import controlnet_hinter


#model_suffixes = {"canny","normal","depth","openpose","hed","scribble","mlsd","seg"}


def write_converted_files(original_image, prefix):
    controlnet_hinter.hint_canny(original_image).save(prefix + '_canny.png')
    controlnet_hinter.hint_depth(original_image).save(prefix + '_depth.png')
    controlnet_hinter.hint_fake_scribble(original_image).save(
        prefix + '_scribble.png')
    controlnet_hinter.hint_hed(original_image).save(prefix + '_hed.png')
    controlnet_hinter.hint_hough(original_image).save(prefix + '_mlsd.png')
    controlnet_hinter.hint_normal(original_image).save(prefix + '_normal.png')
    controlnet_hinter.hint_openpose(
        original_image).save(prefix + '_openpose.png')
    # controlnet_hinter.hint_scribble(
    #     original_image).save(prefix + '_scribble.png')
    controlnet_hinter.hint_segmentation(
        original_image).save(prefix + '_seg.png')


if __name__ == '__main__':
    image_types = {'bird', 'human', 'room', 'vermeer'}
    for itype in image_types:
        image = Image.open(f"control_images/{itype}_512x512.png")
        write_converted_files(
            image, prefix=f'control_images/converted/control_{itype}')