[Image-SIG] separate TIFF
Michele Petrazzo
michele.petrazzo at unipex.it
Fri Nov 17 12:52:01 CET 2006
sergiao at fastwebnet.it wrote:
> Hi guys, i have a TIFF image of 10 pages, i have to make more file of
> 2 pages with a python script, what i have to do?
According to the PIL doc, you can't with PIL.For do this, you can use a
lot of "platform specific" programs, like that on tiff tools, that are
on all (more or less) the linux platforms or compiled by the gnuwin32
team by the win OS (tiffcp and tiffsplit are your friend).
Or you can use FreeImagePy (freeimagepy.sf.net), that are a python lib
that can help you do to it.
you can do something like (with the last freeimagepy release 22):
import FreeImagePy as FIPY
fname = "test.tif"
img = FIPY.Image(fname)
def createImg(num):
img = FIPY.Image()
#The size here it not needed, because every bitmap page set its size
img.new( multiBitmap="file%i.tiff" % num )
return img
for num, bmp in enumerate( img ):
if num % 2 == 0:
#Create a new image
myImg = createImg(num)
#Append a new one
myImg.appendPage( bitmap=bmp )
if num % 2 == 0:
#Delete the first page, according with the freeimage doc
myImg.deletePage(0)
>
> sorry for my bad english
Ciao :),
Michele
More information about the Image-SIG
mailing list