Allow for PNG
This commit is contained in:
@@ -811,19 +811,22 @@ async def convert_file(
|
|||||||
for image in images:
|
for image in images:
|
||||||
# *** Part 1: *** Convert the file and save the file to tmp and then save the hashed file to hosted_files directory.
|
# *** Part 1: *** Convert the file and save the file to tmp and then save the hashed file to hosted_files directory.
|
||||||
|
|
||||||
save_path = os.path.join(hosted_tmp_convert_file_path, 'converted_3840px_lossy_90q.webp')
|
if to_type == 'webp':
|
||||||
# save_path = os.path.join(hosted_tmp_convert_file_path, 'converted_3840px_lossless_100q.webp')
|
save_path = os.path.join(hosted_tmp_convert_file_path, 'converted_3840px_lossy_90q.webp')
|
||||||
|
# save_path = os.path.join(hosted_tmp_convert_file_path, 'converted_3840px_lossless_100q.webp')
|
||||||
|
|
||||||
# image.save('testing_2625px_9.png', compress_level=9)
|
# Lossy WebP takes about 25% of the time as WebP lossless compression with 100 level effort
|
||||||
|
# .46 seconds vs 2.1 seconds with example PDF
|
||||||
|
|
||||||
# Lossy WebP takes about 25% of the time as WebP lossless compression with 100 level effort
|
# image.save('testing_2625px_80q.webp', quality=80) # default
|
||||||
# .46 seconds vs 2.1 seconds with example PDF
|
# timer_2a_start = timer()
|
||||||
|
image.save(save_path, lossless=False, quality=90) # default quality is 80
|
||||||
# image.save('testing_2625px_80q.webp', quality=80) # default
|
# timer_2a_end = timer()
|
||||||
# timer_2a_start = timer()
|
# print( round((timer_2a_end - timer_2a_start), 8) )
|
||||||
image.save(save_path, lossless=False, quality=90) # default quality is 80
|
elif to_type == 'png':
|
||||||
# timer_2a_end = timer()
|
save_path = os.path.join(hosted_tmp_convert_file_path, 'converted_3840px_lossless_9.png')
|
||||||
# print( round((timer_2a_end - timer_2a_start), 8) )
|
image.save(save_path, compress_level=9)
|
||||||
|
else: return False
|
||||||
|
|
||||||
# timer_2b_start = timer()
|
# timer_2b_start = timer()
|
||||||
# image.save('testing_2160px_lossless_100q.webp', lossless=True, quality=100) # quality is level of effort
|
# image.save('testing_2160px_lossless_100q.webp', lossless=True, quality=100) # quality is level of effort
|
||||||
|
|||||||
Reference in New Issue
Block a user