Converter: Remove base64 image support

The get_page method had support to return the image in
base64 format. This feature is no longer used by any
other app.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2018-12-05 14:45:20 -04:00
parent 685d9b6d3e
commit 27c04ed9be

View File

@@ -1,6 +1,5 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import base64
from io import BytesIO from io import BytesIO
import logging import logging
import os import os
@@ -178,7 +177,7 @@ class ConverterBase(object):
fs_cleanup(input_filepath) fs_cleanup(input_filepath)
fs_cleanup(converted_output) fs_cleanup(converted_output)
def get_page(self, output_format=None, as_base64=False): def get_page(self, output_format=None):
output_format = output_format or setting_graphics_backend_arguments.value.get( output_format = output_format or setting_graphics_backend_arguments.value.get(
'pillow_format', DEFAULT_PILLOW_FORMAT 'pillow_format', DEFAULT_PILLOW_FORMAT
) )
@@ -196,10 +195,7 @@ class ConverterBase(object):
self.image.convert(new_mode).save(image_buffer, format=output_format) self.image.convert(new_mode).save(image_buffer, format=output_format)
if as_base64: image_buffer.seek(0)
return 'data:{};base64,{}'.format(Image.MIME[output_format], base64.b64encode(image_buffer.getvalue()))
else:
image_buffer.seek(0)
return image_buffer return image_buffer