Created
October 25, 2019 15:41
-
-
Save jtprogru/467fa47a14a706b30cf3ba8fb70e6363 to your computer and use it in GitHub Desktop.
Simple converting images from JP2 to JPG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding=utf-8 | |
# Created by JTProgru | |
# Date: 2019-10-25 | |
# https://jtprog.ru/ | |
__author__ = 'jtprogru' | |
__version__ = '0.0.1' | |
__author_email__ = '[email protected]' | |
from PIL import Image | |
image_list = [ | |
'/tmp/images/-WBYxmW4yuw', | |
'/tmp/images/yEAOfWSdzgM', | |
'/tmp/images/zE007SNgcdE', | |
'/tmp/images/zEBqF_E2FIY', | |
] | |
def convert_image(orig_image, converted_image): | |
im = Image.open(orig_image) | |
im.convert("RGB").save(converted_image, | |
'JPEG', | |
quality_mode='dB', | |
quality_layers=[41]) | |
for img in image_list: | |
convert_image(orig_image=img + '.jp2', converted_image=img + '.jpg') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment