Created
September 25, 2018 08:38
-
-
Save ice2heart/50afc0da02d8b061f725f17d36d5be6f to your computer and use it in GitHub Desktop.
JPEG degradation
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 python3 | |
# setup | |
# sudo apt install libmagickwand-dev ffmpeg | |
# pip3 install Wand progressbar | |
# ffmpeg -framerate 30 -i out/%05d.jpg -c:v libx264 -r 30 jpeg.mp4 | |
from random import randrange | |
from wand.image import Image | |
import progressbar | |
last_name = 'src0.jpg' | |
for i in progressbar.progressbar(range(300)): | |
with Image(filename=last_name) as img: | |
last_name = 'out/%05d.jpg' % i | |
with img.clone() as im: | |
im.compression = 'jpeg' | |
im.compression_quality = randrange(10, 70) | |
im.save(filename=last_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment