add poster/movieId.size.jpg

This commit is contained in:
j 2010-09-07 16:05:38 +02:00
commit 744dfb101e
8 changed files with 49 additions and 18 deletions

View file

@ -223,14 +223,24 @@ def frame(videoFile, position, baseFolder, width=128, redo=False):
resize_image(frame_base, frame, width)
return frame
def resize_image(image_source, image_output, width):
def resize_image(image_source, image_output, width=None, size=None):
if exists(image_source):
source = Image.open(image_source)
source_width = source.size[0]
source_height = source.size[1]
height = int(width / (float(source_width) / source_height))
height = height - height % 2
if size:
if source_width > source_height:
width = size
height = int(width / (float(source_width) / source_height))
height = height - height % 2
else:
height = size
width = int(height * (float(source_width) / source_height))
width = width - width % 2
else:
height = int(width / (float(source_width) / source_height))
height = height - height % 2
if width < source_width:
resize_method = Image.ANTIALIAS

View file

@ -21,7 +21,6 @@ from ox.normalize import canonicalTitle, canonicalName
from firefogg import Firefogg
from backend import utils
from backend import extract
from pandora.backend.models import Movie
import extract