wenet/test_images/compress_test_images.py

39 wiersze
906 B
Python
Czysty Zwykły widok Historia

#!/usr/bin/env python
#
# Quick script to resize and SSDV-compress a selection of test images.
2018-01-25 03:04:43 +00:00
#
# Copyright (C) 2018 Mark Jessop <vk5qi@rfhead.net>
# Released under GNU GPL v3 or later
#
# Original resolution: 1488x1120
# 800x600
# 640x480
# 320x240
#
# Requires:
# Imagemagick
# ssdv (https://github.com/fsphil/ssdv)
import os, glob
# images should be named 1.jpg, 2.jpg, etc.
image_numbers = xrange(1,14)
new_sizes = ["800x608","640x480","320x240"]
callsign = "VK5QI"
# Resize images.
for x in image_numbers:
# make a copy of the raw image.
os.system("cp %d.jpg %d_raw.jpg" % (x,x))
# Produce resized images.
for size in new_sizes:
os.system("convert %d.jpg -resize %s\! %d_%s.jpg" % (x,size,x,size))
# Compress with SSDV.
new_sizes.append("raw")
for x in image_numbers:
for size in new_sizes:
2016-12-05 11:19:05 +00:00
os.system("ssdv -e -n -q 6 -c %s -i %d %d_%s.jpg %d_%s.ssdv" % (callsign,x,x,size,x,size))