Split a Multi-page TIFF Into Separate Files (Shallow Thoughts)

Akkana's Musings on Open Source Computing and Technology, Science, and Nature.

Sat, 11 Oct 2025

Split a Multi-page TIFF Into Separate Files

My cardiologist wanted me to wear a heart-rate monitor for two weeks.

I'm still hoping I can get the raw data eventually (the company's tech support promised me it was possible), but meanwhile, the data available for download on the medical portal was a text file plus a large TIFF. It turned out the TIFF had 14 subfiles (which is apparently what you call separate images inside a TIFF). I don't have any viewing tools that will let me easily page through TIFF subfiles, so I wanted to split them so I could step through them easily.

Of course GIMP can load them as layers, and I could write a GIMP script to save the layers separately ... but surely there was a way that didn't require programming. I certainly didn't want to save 14 layers by hand, one by one.

All over the web, I found advice to use ImageMagick with a command like convert infile.tiff outfile-%02d.jpg but it didn't work; it just gave me a single file named outfile-%02d.jpg. One discussion suggested convert infile.tiff -scene 1 outfile-%02d.jpg — I didn't find any explanation of what the -scene 1 meant — but it didn't help.

I did a little poking around to see if maybe Python's PIL could do it, but didn't find anything (because I was searching on the wrong search terms: see below).

Finally I asked on #gimp. The GIMP community knows a lot about image processing in general, and is big on using the right tool for the job, which is sometimes something like ImageMagick or Inkscape rather than GIMP. Liam had a working answer (thanks!)

convert infile.tiff +adjoin outfile-%02d.jpg

Later, while writing this up, I looked up the details on TIFF and learned the "subfile" term, and I tried searching again for PIL commands. It turns out Python can indeed split a TIFF:

from PIL import Image, ImageSequence

im = Image.open("multipage.tif")

for i, page in enumerate(ImageSequence.Iterator(im)):
    page.save("page%d.png" % i)

It's always nice to have options, though the ImageMagick solution is the easiest once you know about +adjoin.

Tags: , , ,
[ 19:51 Oct 11, 2025    More linux | permalink to this entry | ]

Comments via Disqus:

blog comments powered by Disqus