assa sittner wrote:

I would like to generate a series of synthetic images, and then wrap them all up into a single-file .tif stack (like in metamorph or ImageJ).
how can i do that in python?

you can use PIL to create the individual frames, but PIL doesn't contain any ready-made API for creating stacks; the simplest approach is probably to write the frames to disk, and then use the external "tiffcp"
command to build the final file.

outline:

    command = ["tiffcp"]
    # add options here, if any (e.g. for compression)

    for i in range(...):
        im = Image.new(...)
        ...
        framefile = "frame%d.tif" % i
        im.save(framefile)
        command.append(framefile)

    command.append("stack.tif")
    subprocess.call(command)

    # remove frame files here

</F>

_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to