Skip to content

Instantly share code, notes, and snippets.

@jtprogru
Created October 25, 2019 15:41
Show Gist options
  • Save jtprogru/467fa47a14a706b30cf3ba8fb70e6363 to your computer and use it in GitHub Desktop.
Save jtprogru/467fa47a14a706b30cf3ba8fb70e6363 to your computer and use it in GitHub Desktop.
Simple converting images from JP2 to JPG
#!/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__ = 'mail@jtprog.ru'
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