update json

pull/144/head^2
spirit 2019-11-29 12:11:37 +08:00
parent 4e4d28fcd0
commit 4cc44b9dd0
20 changed files with 13 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 KiB

After

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 892 KiB

After

Width:  |  Height:  |  Size: 895 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 KiB

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -1 +1 @@
{"070a095cf72042b8eebe78124f8225bb": {"source": "AK-01.jpg", "jpeg": "jpeg/070a095cf72042b8eebe78124f8225bb.jpeg", "webp": "webp/070a095cf72042b8eebe78124f8225bb.webp"}, "015a11a57f73ec3887bdf77f8f8a02f9": {"source": "AK-02.jpg", "jpeg": "jpeg/015a11a57f73ec3887bdf77f8f8a02f9.jpeg", "webp": "webp/015a11a57f73ec3887bdf77f8f8a02f9.webp"}, "fb7ab0a3878d821fffa8c1f06ec5e8d2": {"source": "AK-03.jpg", "jpeg": "jpeg/fb7ab0a3878d821fffa8c1f06ec5e8d2.jpeg", "webp": "webp/fb7ab0a3878d821fffa8c1f06ec5e8d2.webp"}, "fbefd92059006090601cb6dafdce544c": {"source": "AK-04.jpg", "jpeg": "jpeg/fbefd92059006090601cb6dafdce544c.jpeg", "webp": "webp/fbefd92059006090601cb6dafdce544c.webp"}, "fcff045964e4ac6fffd84a8192a0a393": {"source": "AK-05.jpg", "jpeg": "jpeg/fcff045964e4ac6fffd84a8192a0a393.jpeg", "webp": "webp/fcff045964e4ac6fffd84a8192a0a393.webp"}}
{"fbefd92059006090601cb6dafdce544c": {"source": "AK-04.jpg", "jpeg": ["jpeg/fbefd92059006090601cb6dafdce544c.jpeg", "jpeg/fbefd92059006090601cb6dafdce544c.th.jpeg"], "webp": ["webp/fbefd92059006090601cb6dafdce544c.webp", "webp/fbefd92059006090601cb6dafdce544c.th.webp"]}, "fcff045964e4ac6fffd84a8192a0a393": {"source": "AK-05.jpg", "jpeg": ["jpeg/fcff045964e4ac6fffd84a8192a0a393.jpeg", "jpeg/fcff045964e4ac6fffd84a8192a0a393.th.jpeg"], "webp": ["webp/fcff045964e4ac6fffd84a8192a0a393.webp", "webp/fcff045964e4ac6fffd84a8192a0a393.th.webp"]}, "015a11a57f73ec3887bdf77f8f8a02f9": {"source": "AK-02.jpg", "jpeg": ["jpeg/015a11a57f73ec3887bdf77f8f8a02f9.jpeg", "jpeg/015a11a57f73ec3887bdf77f8f8a02f9.th.jpeg"], "webp": ["webp/015a11a57f73ec3887bdf77f8f8a02f9.webp", "webp/015a11a57f73ec3887bdf77f8f8a02f9.th.webp"]}, "fb7ab0a3878d821fffa8c1f06ec5e8d2": {"source": "AK-03.jpg", "jpeg": ["jpeg/fb7ab0a3878d821fffa8c1f06ec5e8d2.jpeg", "jpeg/fb7ab0a3878d821fffa8c1f06ec5e8d2.th.jpeg"], "webp": ["webp/fb7ab0a3878d821fffa8c1f06ec5e8d2.webp", "webp/fb7ab0a3878d821fffa8c1f06ec5e8d2.th.webp"]}, "070a095cf72042b8eebe78124f8225bb": {"source": "AK-01.jpg", "jpeg": ["jpeg/070a095cf72042b8eebe78124f8225bb.jpeg", "jpeg/070a095cf72042b8eebe78124f8225bb.th.jpeg"], "webp": ["webp/070a095cf72042b8eebe78124f8225bb.webp", "webp/070a095cf72042b8eebe78124f8225bb.th.webp"]}}

View File

@ -1,4 +1,4 @@
#coding=utf-8
# coding=utf-8
'''
Created on Apr 23, 2018
Desc: Webp convertor
@ -23,23 +23,32 @@ class Single(object):
self.hash = hasher.hexdigest()
self.jpeg = 'jpeg/' + self.hash + '.jpeg'
self.webp = 'webp/' + self.hash + '.webp'
self.th_jpeg = 'jpeg/' + self.hash + '.th.jpeg'
self.th_webp = 'webp/' + self.hash + '.th.webp'
def optimize(self):
im = Image.open('gallary/' + self.file).convert('RGB')
im.save(self.jpeg, 'JPEG') # todo: TinyPNG API
im.save(self.webp, 'WEBP')
def thumbnail(self):
im = Image.open('gallary/' + self.file).convert('RGB')
im.thumbnail((450, 300))
im.save(self.th_jpeg, 'JPEG') # todo: TinyPNG API
im.save(self.th_webp, 'WEBP')
def manifest(self):
self.mani[self.hash] = {
'source': self.file,
'jpeg': 'jpeg/' + self.hash + '.jpeg',
'webp': 'webp/' + self.hash + '.webp'
'jpeg': ['jpeg/' + self.hash + '.jpeg', 'jpeg/' + self.hash + '.th.jpeg'],
'webp': ['webp/' + self.hash + '.webp', 'webp/' + self.hash + '.th.webp']
}
def main(self):
self.hash()
# if os.path.exists(self.jpeg) and os.path.exists(self.webp):
self.optimize()
self.thumbnail()
self.manifest()
return self.mani

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 660 KiB

After

Width:  |  Height:  |  Size: 661 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 KiB

After

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB