File types · Explainer

The PTIF file (.ptif, pyramid .tif)

A PTIF file is a pyramid TIFF: an ordinary TIFF that stores a large image in small tiles, together with copies at half, a quarter and an eighth of the size, so a viewer can zoom into gigapixel images by fetching only the tiles on screen. This guide explains how it's built, how image servers use it, how to make one, and how it relates to BigTIFF and Cloud Optimized GeoTIFF.

At a glance

Full name
Pyramid TIFF, also called pyramidal or tiled multi-resolution TIFF
Extensions
Usually .tif or .tiff; .ptif or .ptiff to mark it out. Whole-slide microscopy formats such as Aperio .svs use the same idea
MIME type
image/tiff; there's no separate type
Kind
Binary TIFF with tiled images at successively halved resolutions; JPEG, Deflate, LZW, WebP or Zstandard compression
Standard
No specification of its own: it uses tiles and reduced-resolution images from TIFF 6.0. Cloud Optimized GeoTIFF formalises a similar layout as an OGC standard
Tile size
Commonly 256 × 256 pixels; libvips defaults to 128, GDAL's COG driver to 512
Levels
Each level is half the width and height of the one before, usually down to a size that fits in one tile; together they add about a third to the full image
Max file size
4 GB as classic TIFF; BigTIFF (64-bit offsets) for anything larger
Magic number
49 49 2A 00 or 4D 4D 00 2A, as any TIFF; BigTIFF has 2B instead of 2A
Used by
IIPImage and other IIIF image servers, deep-zoom viewers, OpenSlide, GDAL and libvips

The basics

What is a PTIF file?

A pyramid TIFF holds one very large image in a form that is quick to view at any size. Think of a museum's 2-gigapixel scan of a painting, a map sheet, or a microscope slide: far too big to send to a browser in one piece. Stored as a pyramid TIFF, it can be shown by a deep-zoom viewer that starts with an overview and loads sharper tiles only for the area you zoom into, the way online maps work.

Two ordinary TIFF features make this work:

  • Tiles: the image is stored as small squares, each compressed separately, so any region can be read without decoding the rest.
  • Several resolutions: the file also holds copies of the image at 1/2, 1/4, 1/8 of the size, and so on. Stacked from the largest at the bottom to the smallest at the top, they form the pyramid.

Because it's a normal TIFF underneath, there's no separate standard and no separate media type. The .ptif extension is a convention that some tools and image servers use to mark the file out; many pyramid TIFFs are simply .tif.

Where you'll meet one

Mostly on the server side: in museums, libraries and archives behind zoomable viewers, in digital pathology as whole-slide images, and in mapping as Cloud Optimized GeoTIFFs. Visitors to those sites see the image tile by tile in their browser and rarely download the file itself.

Anatomy

What's inside a pyramid TIFF

There are no sample files on this page, so to show real structure we made a small pyramid TIFF with libvips from a 2000 × 1500 test image: 256 × 256 JPEG tiles, 117,582 bytes in all. Like any TIFF, it's a header followed by a chain of image file directories (IFDs), each a list of numbered tags. Here each IFD is one level of the pyramid, and libvips writes each level's tiles just before its IFD.

A 2000 × 1500 pyramid TIFF (header and IFD map)
49 49 2A 00  80 12 01 00

offset  part
000000  header: "II" (little-endian), 42, first IFD at 0x011280
000008  level 0 data: 48 JPEG tiles (8 × 6), 70,263 bytes
011280  IFD 0: the full image, 17 tags
          tag   name             value
          0100  ImageWidth       2000
          0101  ImageLength      1500
          0103  Compression      7 (JPEG)
          0106  Photometric      6 (YCbCr)
          0142  TileWidth        256
          0143  TileLength       256
          0144  TileOffsets      48 offsets, one per tile
          0145  TileByteCounts   48 lengths
          015B  JPEGTables       574 bytes shared by the tiles
          next IFD → 0x018790
01172C  level 1 data: 12 tiles (4 × 3), 28,772 bytes
018790  IFD 1: 1000 × 750, NewSubfileType 1 (reduced resolution)
          next IFD → 0x01B60A
018B28  level 2 data: 4 tiles (2 × 2), 10,977 bytes
01B60A  IFD 2: 500 × 375, NewSubfileType 1
01B962  level 3 data: 1 tile, 3,764 bytes
01C816  IFD 3: 250 × 187, NewSubfileType 1
          next IFD → 0: the last level
        end of file at 117,582 bytes
  1. 149 49 2A 00 80 12 01 00

    An ordinary TIFF header

    II for little-endian, the number 42, and the offset of the first IFD: 0x011280, after the first level's tiles. Nothing here says "pyramid": to any TIFF reader this is a normal file, which is why a pyramid TIFF opens, at least partly, in ordinary image software.

  2. 20142 TileWidth, 0143 TileLength

    Tiles instead of strips

    The image is cut into 256 × 256 squares instead of horizontal strips, so a server can decode the part of the image a viewer is looking at. Tiles at the right and bottom edges are padded to full size.

  3. 30144 TileOffsets, 0145 TileByteCounts

    The tile index

    One offset and one length per tile, row by row: 8 across and 6 down for the full image. A server reads these two tables once and can then jump straight to any tile.

  4. 40103 Compression 7, 015B JPEGTables

    JPEG-compressed tiles

    Each tile is a small JPEG. The quantisation and Huffman tables they share are stored once per level in JPEGTables, so each tile carries only its own coded data. Deflate, LZW or Zstandard keep tiles lossless at a larger size.

  5. 5IFD 1: 1000 × 750, NewSubfileType 1

    The next level down

    Half the width and height of the level above, in the same size tiles. The NewSubfileType tag's first bit marks it as a reduced-resolution version of another image, so readers know it's not a separate page.

  6. 6IFD 3: 250 × 187

    The top of the pyramid

    libvips stops once a level fits in a single tile. A viewer starts here, showing the whole picture from one 3,764-byte tile, then fetches more detailed tiles as you zoom in.

  7. 7next IFD → 0

    The end of the chain

    The last IFD points to offset 0. The four levels together are 2000 × 1500, 1000 × 750, 500 × 375 and 250 × 187 pixels.

Under the hood

How the pyramid is stored

The levels of the 2000 × 1500 example above, in 256 × 256 tiles
LevelSizeTilesShare of the pixels
0 (full)2000 × 15008 × 6 = 48100%
11000 × 7504 × 3 = 1225%
2500 × 3752 × 2 = 46.25%
3250 × 18711.6%

Each level has a quarter of the pixels of the one below, so the whole pyramid adds only about a third to the size of the full image. In exchange, a viewer showing the picture at any zoom level never needs to decode more than a screenful of tiles.

Tools differ in where they put the smaller levels:

  • As further pages (IFDs in the main chain), each flagged as reduced resolution. This is what libvips writes by default, and what the example shows.
  • As SubIFDs of the main image, hidden from the page list. libvips writes this with --subifd, which suits formats such as OME-TIFF for microscopy.
  • With all IFDs at the start and the smallest level's tiles first, as Cloud Optimized GeoTIFF does, so a client reading over the network gets the whole index in its first request.

Whole-slide microscopy formats add their own twists. OpenSlide's documentation describes Aperio's .svs files as single-file pyramidal tiled TIFFs, with a stripped thumbnail as the second image and optional label and macro photographs of the glass slide at the end.

On the web

How image servers use pyramid TIFFs

Browsers can't open a pyramid TIFF directly; most can't display TIFF at all. An image server sits in between. IIPImage, for example, reads tiled pyramid TIFF and JPEG 2000 files and answers requests in several tile protocols, including IIIF, Zoomify and DeepZoom, sending each tile as JPEG, PNG, WebP or AVIF.

The most widely used protocol in libraries and museums is the IIIF Image API (International Image Interoperability Framework). Every request is a URL naming the image, the region, the output size, the rotation, the quality and the format. A viewer first fetches info.json, which lists the image's size, tile size and available scale factors, then asks for the tiles it needs:

IIIF requests
# what a deep-zoom viewer asks a IIIF image server for
https://images.example.org/iiif/3/scan.tif/info.json
https://images.example.org/iiif/3/scan.tif/0,0,1024,1024/256,/0/default.jpg
https://images.example.org/iiif/3/scan.tif/full/600,/0/default.jpg

With a pyramid TIFF behind it, the server answers each of these by decoding a handful of tiles from the right level, instead of scaling the whole image down for every request.

How to

How to make a pyramid TIFF

The usual tool is libvips, which processes huge images in small pieces without loading them whole. Its tiffsave operation writes a pyramid with --tile --pyramid; IIPImage's documentation recommends 256 × 256 tiles:

terminal
# 256 × 256 tiles, JPEG at quality 85, one level per halving
vips tiffsave scan.png scan.tif --tile --pyramid \
  --compression jpeg --Q 85 --tile-width 256 --tile-height 256

# lossless instead, and BigTIFF for files that may pass 4 GB
vips tiffsave scan.png scan.tif --tile --pyramid \
  --compression deflate --tile-width 256 --tile-height 256 --bigtiff

# check the result: one tiled directory per level
tiffinfo scan.tif | grep -E "Image Width|Tile Width"
  • Compression: JPEG or WebP make small files for viewing. Deflate or Zstandard keep every pixel; IIPImage suggests Deflate for compatibility and Zstandard for size and speed.
  • Size: add --bigtiff whenever the file could pass 4 GB, the limit of classic TIFF. The server's libtiff must support BigTIFF, which libtiff 4 and later do.
  • Maps: GDAL's COG driver writes Cloud Optimized GeoTIFFs: gdal_translate input.tif output.tif -of COG. It uses 512 × 512 tiles and LZW compression by default.
  • Check the result with tiffinfo: you should see one tiled directory per level, each half the size of the last. A tool that silently writes a single level, or strips instead of tiles, gives a file that's valid but slow to serve.

Comparison

Pyramid TIFF vs COG, JPEG 2000 and Deep Zoom tiles

Pyramid TIFFCloud Optimized GeoTIFFJPEG 2000Deep Zoom (DZI) folder
What it isOne TIFF, tiled, one IFD per levelThe same, with map coordinates and a fixed layout for network readingOne file whose wavelet coding contains every resolutionAn XML file plus thousands of small JPEG or PNG tiles
Smaller levelsStored separately (about +33%)Stored separately (overviews)Built into the coding, no extra copiesStored separately
Needs a serverAn image server such as IIPImageNo: clients read byte ranges straight from cloud storageAn image serverNo: any static web host
Decoding costLow (JPEG tiles)LowHigherNone on the server
Typical useMuseums, archives, pathologySatellite images and mapsArchives that keep JP2 mastersSimple zoomable images on any site

A COG is a pyramid TIFF with stricter rules: tiles, overviews, GeoTIFF tags, and IFDs at the start of the file. Clients read it over plain HTTP with range requests, fetching only the bytes they need, so no image server is needed. See our JP2 page for how JPEG 2000 gets resolutions out of a single codestream.

How to

How to open and inspect a PTIF file

  • Look inside: tiffinfo scan.tif lists every directory with its size, tiling and compression; vipsheader -a scan.tif shows the same through libvips; gdalinfo lists a COG's overviews.
  • View it: rename a copy to .tif if needed and open it in an image editor that handles large TIFFs, such as GIMP, or use a whole-slide viewer for microscopy files. Ordinary viewers show the first, full-size level and may struggle with its size.
  • Extract a level: vips copy "scan.tif[page=2]" level2.png writes the third level (500 × 375 in the example) as a PNG.
  • Turn it into a folder of tiles for a static website: vips dzsave scan.tif scan writes Deep Zoom tiles that viewers such as OpenSeadragon can show without an image server.

Troubleshooting

Common pyramid TIFF problems

  • The image server is slow. The file is probably striped, not tiled, or has only one level, so the server decodes huge areas for every tile. Rebuild it with vips tiffsave … --tile --pyramid.
  • Writing stops at 4 GB, or the file is corrupt. Classic TIFF can't address more. Save with --bigtiff.
  • An ordinary app freezes opening it. It's decoding the full-size level, which may be billions of pixels. Use vips or a deep-zoom viewer, or extract a smaller level.
  • JPEG tiles fail to decode in some tools. JPEG-in-TIFF with shared JPEGTables and YCbCr colour isn't supported everywhere. Re-save with Deflate if the file has to work in many programs.
  • Visible seams between tiles. Heavy lossy compression treats each tile separately; raise the quality, or use lossless compression for master files.
  • Huge declared dimensions. A small file can describe an enormous image. Servers that accept uploads should check the size in the first IFD before decoding.

Sample files

There are no sample pyramid TIFF files on this page yet. To make one for testing, run vips tiffsave input.jpg output.tif --tile --pyramid --compression jpeg --tile-width 256 --tile-height 256 with libvips, or start from the tiled, single-level sample on our TIFF page.

Put it online

Have a PTIF file? Give it a link.

Drop a pyramid TIFF on 99helpers and it gets its own web address to share. Browsers can't display it, so anyone who opens the link downloads the whole file; for zooming in the browser, it needs an image server or a folder of tiles.

Questions

PTIF files, frequently asked

What is a PTIF file?

A pyramid TIFF: a TIFF file that stores a large image in tiles, with copies at successively halved resolutions, so image servers and deep-zoom viewers can show any part at any zoom level quickly.

Is a PTIF file the same as a TIFF?

Yes, it's a valid TIFF that uses tiles and extra reduced-resolution images. You can rename .ptif to .tif; ordinary TIFF readers usually show the full-size level.

How do I open a PTIF file?

Rename a copy to .tif if needed and open it in GIMP or another editor that handles large TIFFs, or use vips to extract a smaller level. For zooming, serve it through an image server such as IIPImage.

How do I create a pyramid TIFF?

With libvips: vips tiffsave input.jpg output.tif --tile --pyramid --compression jpeg --tile-width 256 --tile-height 256. Add --bigtiff for files that may pass 4 GB.

What tile size should I use?

256 × 256 is the common choice for image servers and IIIF viewers. Larger tiles, such as the 512 × 512 GDAL uses for COGs, mean fewer requests but more data per request.

What's the difference between a pyramid TIFF and a COG?

A Cloud Optimized GeoTIFF is a pyramid TIFF with map coordinates and a layout designed for reading over HTTP: all directories at the start, so clients can fetch parts directly from cloud storage without an image server.

Can a browser show a pyramid TIFF?

Not directly. A deep-zoom viewer in the page loads tiles from an image server that reads the TIFF, or from a folder of tiles made from it.

Related formats

Other file types explained

Keep going

Related

Sources

Last reviewed 27 October 2026.