mirror of https://github.com/patacrep/patacrep.git
Romain Goffe
13 years ago
3 changed files with 22 additions and 18 deletions
@ -0,0 +1,21 @@ |
|||||
|
#!/usr/bin/python |
||||
|
# -*- coding: utf-8 -*- |
||||
|
|
||||
|
#Author: Romain Goffe |
||||
|
#Date: 28/12/2011 |
||||
|
#Description: Resize all covers to 128,128 thumbnails |
||||
|
|
||||
|
import Image |
||||
|
import glob |
||||
|
|
||||
|
width = 128 |
||||
|
height = 128 |
||||
|
|
||||
|
# Process song files |
||||
|
covers = glob.glob('songs/*/*.jpg') |
||||
|
for filename in covers: |
||||
|
source = Image.open(filename) |
||||
|
if source.size > (128, 128): |
||||
|
print "resizing : " + filename |
||||
|
target = source.resize((width, height), Image.ANTIALIAS) |
||||
|
target.save(filename) |
@ -1,17 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
# Resize image if needed |
|
||||
|
|
||||
for image in songs/*/*.jpg songs/*/*.png ; |
|
||||
do |
|
||||
SIZE=`identify $image | awk '{ print $3}' | sed 's/x/ /'`; |
|
||||
XSIZE=`echo $SIZE | awk '{ print $1}'`; |
|
||||
YSIZE=`echo $SIZE | awk '{ print $2}'`; |
|
||||
|
|
||||
if [ $((XSIZE)) -gt 128 ] |
|
||||
then |
|
||||
convert $image -resize 128x128 $image; |
|
||||
elif [ $((YSIZE)) -gt 128 ] |
|
||||
then |
|
||||
convert $image -resize 128x128 $image; |
|
||||
fi |
|
||||
done; |
|
Loading…
Reference in new issue