Merge pull request #67 from jiayiliu/master

improve image output format
This commit is contained in:
Abubakar Abid 2020-10-06 16:53:14 +03:00 committed by GitHub
commit 4cc1cb3e04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 4 deletions

View File

@ -4,6 +4,8 @@ class Component():
"""
def __init__(self, label):
if label is None:
label = self.__class__.__name__
self.label = label
def get_template_context(self):

View File

@ -175,8 +175,7 @@ class Image(OutputComponent):
"""
im = processing_utils.decode_base64_to_image(data)
timestamp = datetime.datetime.now()
filename = 'output_{}.png'.format(timestamp.
strftime("%Y-%m-%d-%H-%M-%S"))
filename = 'output_{}_{}.png'.format(self.label, timestamp.strftime("%Y-%m-%d-%H-%M-%S"))
im.save('{}/{}'.format(dir, filename), 'PNG')
return filename

View File

@ -4,6 +4,8 @@ class Component():
"""
def __init__(self, label):
if label is None:
label = self.__class__.__name__
self.label = label
def get_template_context(self):

View File

@ -175,8 +175,7 @@ class Image(OutputComponent):
"""
im = processing_utils.decode_base64_to_image(data)
timestamp = datetime.datetime.now()
filename = 'output_{}.png'.format(timestamp.
strftime("%Y-%m-%d-%H-%M-%S"))
filename = 'output_{}_{}.png'.format(self.label, timestamp.strftime("%Y-%m-%d-%H-%M-%S"))
im.save('{}/{}'.format(dir, filename), 'PNG')
return filename