Converter: Add transformation serialization

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-11-16 21:51:32 -04:00
parent 4ee6add201
commit 823083a76c

View File

@@ -75,6 +75,15 @@ class BaseTransformation(object):
self.image = image
self.aspect = 1.0 * image.size[0] / image.size[1]
def serialize(self):
kwargs = []
for key, value in sorted(self.kwargs.items()):
kwargs.append(
'{}:{}'.format(key, value)
)
return '{};{}'.format(self.name, ','.join(kwargs))
class TransformationCrop(BaseTransformation):
arguments = ('left', 'top', 'right', 'bottom',)