gallerifrey.py
def createThumbnails(images):
    """Makes thumbnail images for all the image files, in the THUMBDIR."""
    for i in images:
        infile = os.path.join(IMAGEDIR, i)
        outfile = os.path.join(THUMBDIR, i)
        # Skip already-existing thumbnails
        if os.path.isfile(outfile): continue
        
        a = PythonMagick.Image(infile)
        size = a.size()
        w = size.width()
        h = size.height()
        aspectRatio = float(w) / float(h)
        if aspectRatio > 1.0:
            # Resize based on width
            scalefactor = float(w) / THUMBSIZE
            height = int(h / scalefactor)
            g = PythonMagick.Geometry(THUMBSIZE, height)
        else:
            # Resize based on height
            scalefactor = float(h) / THUMBSIZE
            width = int(w / scalefactor)
            g = PythonMagick.Geometry(width, THUMBSIZE)
        a.resize(g)
        a.write(outfile)
Makes thumbnail images for all the image files, in the THUMBDIR.
Makes thumbnail images for all the image files, in the THUMBDIR.
Makes thumbnail images for all the image files in the THUMBDIR .
def createThumbnails(images):
    for i in images:
        infile = os.path.join(IMAGEDIR, i)
        outfile = os.path.join(THUMBDIR, i)
        if os.path.isfile(outfile): continue
        a = PythonMagick.Image(infile)
        size = a.size()
        w = size.width()
        h = size.height()
        aspectRatio = float(w) / float(h)
        if aspectRatio > 1.0:
            scalefactor = float(w) / THUMBSIZE
            height = int(h / scalefactor)
            g = PythonMagick.Geometry(THUMBSIZE, height)
        else:
            scalefactor = float(h) / THUMBSIZE
            width = int(w / scalefactor)
            g = PythonMagick.Geometry(width, THUMBSIZE)
        a.resize(g)
        a.write(outfile)
def createThumbnails ( images ) : for i in images : infile = os . path . join ( IMAGEDIR , i ) outfile = os . path . join ( THUMBDIR , i ) if os . path . isfile ( outfile ) : continue a = PythonMagick . Image ( infile ) size = a . size ( ) w = size . width ( ) h = size . height ( ) aspectRatio = float ( w ) / float ( h ) if aspectRatio > 1.0 : scalefactor = float ( w ) / THUMBSIZE height = int ( h / scalefactor ) g = PythonMagick . Geometry ( THUMBSIZE , height ) else : scalefactor = float ( h ) / THUMBSIZE width = int ( w / scalefactor ) g = PythonMagick . Geometry ( width , THUMBSIZE ) a . resize ( g ) a . write ( outfile )
Makes thumbnail images for all the image files, in the THUMBDIR.
Makes thumbnail images for all the image files in the THUMBDIR .
"""Makes thumbnail images for all the image files, in the THUMBDIR.""" # Skip already-existing thumbnails # Resize based on width # Resize based on height
images