except Exception, e:
            logging.warning("Couldn't open %s. It may be corrupt, you may need to delete it. %s", q2path, e)
    if q3path:
        try:
            quad3 = Image.open(q3path).resize((192, 192), Image.ANTIALIAS)
            img.paste(quad3, (192, 192))
        except Exception, e:
            logging.warning("Couldn't open %s. It may be corrupt, you may need to delete it. %s", q3path, e)

    # Save it
    if imgformat == "jpg":
        img.save(imgpath, quality=95, subsampling=0)
    else:  # png
        img.save(imgpath)
        if optimizeimg:
            optimize_image(imgpath, imgformat, optimizeimg)

    with open(hashpath, "wb") as hashout:
        hashout.write(newhash)


@catch_keyboardinterrupt
def render_worldtile(chunks, colstart, colend, rowstart, rowend, path, imgformat, optimizeimg):
    """Renders just the specified chunks into a tile and save it. Unlike usual
    python conventions, rowend and colend are inclusive. Additionally, the
    chunks around the edges are half-way cut off (so that neighboring tiles
    will render the other half)

    chunks is a list of (col, row, filename) of chunk images that are relevant
    to this call
        
        for path in quadPath_filtered:
            try:
                quad = Image.open(path[1]).resize((192,192), Image.ANTIALIAS)
                img.paste(quad, path[0])
            except Exception, e:
                logging.warning("Couldn't open %s. It may be corrupt, you may need to delete it. %s", path[1], e)

        # Save it
        if self.imgformat == 'jpg':
            img.save(imgpath, quality=self.imgquality, subsampling=0)
        else: # png
            img.save(imgpath)
            
        if self.optimizeimg:
            optimize_image(imgpath, self.imgformat, self.optimizeimg)



    def render_worldtile(self, chunks, colstart, colend, rowstart, rowend, path, poi_queue=None):
        """Renders just the specified chunks into a tile and save it. Unlike usual
        python conventions, rowend and colend are inclusive. Additionally, the
        chunks around the edges are half-way cut off (so that neighboring tiles
        will render the other half)

        chunks is a list of (col, row, chunkx, chunky, filename) of chunk
        images that are relevant to this call (with their associated regions)

        The image is saved to path+"."+self.imgformat

        If there are no chunks, this tile is not saved (if it already exists, it is
Beispiel #3
0
    if q3path:
        try:
            quad3 = Image.open(q3path).resize((192, 192), Image.ANTIALIAS)
            img.paste(quad3, (192, 192))
        except Exception, e:
            logging.warning(
                "Couldn't open %s. It may be corrupt, you may need to delete it. %s",
                q3path, e)

    # Save it
    if imgformat == 'jpg':
        img.save(imgpath, quality=95, subsampling=0)
    else:  # png
        img.save(imgpath)
        if optimizeimg:
            optimize_image(imgpath, imgformat, optimizeimg)

    with open(hashpath, "wb") as hashout:
        hashout.write(newhash)


@catch_keyboardinterrupt
def render_worldtile(chunks, colstart, colend, rowstart, rowend, path,
                     imgformat, optimizeimg):
    """Renders just the specified chunks into a tile and save it. Unlike usual
    python conventions, rowend and colend are inclusive. Additionally, the
    chunks around the edges are half-way cut off (so that neighboring tiles
    will render the other half)

    chunks is a list of (col, row, filename) of chunk images that are relevant
    to this call