Rodrigo_Cobo
commited on
Commit
·
ecd9245
1
Parent(s):
faac476
better gif quality
Browse files- WiggleResults/split.py +8 -2
WiggleResults/split.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
import os
|
2 |
from PIL import Image
|
3 |
import argparse
|
|
|
|
|
4 |
|
5 |
parser = argparse.ArgumentParser(description='change to useful name')
|
6 |
parser.add_argument('--dim', default=128, type=int, help='dimention image')
|
@@ -61,7 +63,7 @@ for file in dirs:
|
|
61 |
rowImages = []
|
62 |
im = Image.open("./" + ROOT_DIR + '/' + file)
|
63 |
width, height = im.size
|
64 |
-
im = im.convert('
|
65 |
|
66 |
#CROP (left, top, right, bottom)
|
67 |
|
@@ -71,13 +73,17 @@ for file in dirs:
|
|
71 |
while (pointtop < height):
|
72 |
while (pointleft < width):
|
73 |
im1 = im.crop((pointleft, pointtop, dim+pointleft, dim+pointtop))
|
74 |
-
|
|
|
|
|
75 |
#im1.show()
|
76 |
pointleft+= dim+4
|
77 |
# Ya tengo todas las imagenes podria hacer el gif aca
|
78 |
rowImages = gif_order(rowImages,center=False)
|
79 |
name = "./" + ROOT_DIR + '/' + file[:-4] + "_" + str(i) + '.gif'
|
80 |
rowImages[0].save(name, save_all=True,format='GIF', append_images=rowImages[1:], optimize=True, duration=100, loop=0)
|
|
|
|
|
81 |
pointtop += dim + 4
|
82 |
pointleft = 3
|
83 |
rowImages = []
|
|
|
1 |
import os
|
2 |
from PIL import Image
|
3 |
import argparse
|
4 |
+
import imageio
|
5 |
+
import numpy as np
|
6 |
|
7 |
parser = argparse.ArgumentParser(description='change to useful name')
|
8 |
parser.add_argument('--dim', default=128, type=int, help='dimention image')
|
|
|
63 |
rowImages = []
|
64 |
im = Image.open("./" + ROOT_DIR + '/' + file)
|
65 |
width, height = im.size
|
66 |
+
im = im.convert('P')
|
67 |
|
68 |
#CROP (left, top, right, bottom)
|
69 |
|
|
|
73 |
while (pointtop < height):
|
74 |
while (pointleft < width):
|
75 |
im1 = im.crop((pointleft, pointtop, dim+pointleft, dim+pointtop))
|
76 |
+
h1 = im1.size[0] * 4
|
77 |
+
im1 = im1.resize([h1,h1], Image.Resampling.LANCZOS)
|
78 |
+
rowImages.append(im1)
|
79 |
#im1.show()
|
80 |
pointleft+= dim+4
|
81 |
# Ya tengo todas las imagenes podria hacer el gif aca
|
82 |
rowImages = gif_order(rowImages,center=False)
|
83 |
name = "./" + ROOT_DIR + '/' + file[:-4] + "_" + str(i) + '.gif'
|
84 |
rowImages[0].save(name, save_all=True,format='GIF', append_images=rowImages[1:], optimize=True, duration=100, loop=0)
|
85 |
+
|
86 |
+
#print(rowImages)
|
87 |
pointtop += dim + 4
|
88 |
pointleft = 3
|
89 |
rowImages = []
|