width  = lfp.refocus_stack.default_width
            height = lfp.refocus_stack.default_height
        except:
            raise Exception("Not a Processed LFP Picture file")

        p_app_focused = PImage.open(StringIO(images[0].chunk.data))
        p_images = dict((image.chunk.sha1, PImage.open(StringIO(image.chunk.data)))
            for image in images)

        for i in xrange(depth_lut.width):
            for j in xrange(depth_lut.height):
                box = (int(math.floor(width  * i / depth_lut.width)),
                       int(math.floor(height * j / depth_lut.height)),
                       int(math.floor(width  * (i+1) / depth_lut.width)),
                       int(math.floor(height * (j+1) / depth_lut.height)))
                most_focused = lfp.find_most_focused(i, j)
                p_most_focused = p_images[most_focused.chunk.sha1]
                piece = p_most_focused.crop(box)
                p_app_focused.paste(piece, box)

        for format_ in OUTPUT_FORMATS:
            output = StringIO()
            p_app_focused.save(output, format_)
            lfp.export_write('all_focus', format_, output.getvalue())
            output.close()

    except Exception as err:
        print >>sys.stderr, "Error:", err
        exit(1)