Skip to content

PFF format description

Ophir LOJKINE edited this page Mar 13, 2015 · 21 revisions

Constants

CHUNKSIZE = 256
HEADEROVERHEAD = 0x424

File format description

A pff file is composed of four parts :

  • A header, containing general information about the file. Its size is 0x424.
  • A table of JFIF image headers. One of this header has to be appended to the each tile to form a valid JPEG file.
  • A table of pointers to the tiles contents.
  • The tile contents.

Header

Data Offset in file (in bytes) Size (in bytes)
Version 0x8 4
Size of the JFIF image headers table 0x74 4
Number of tiles 0x7c 4
width 0x41c 4
height 0x420 4

The size of the header is fixed (0x424 bytes). It seems to be composed of three parts of size 904, 136, and 20.

I don't understand all the bytes in this header. There are many zeros.

JFIF image headers table

Data Offset in file (in bytes) Size (in bytes)
Number of elements in the table 0x424 4
Size of the first element 0x428 4
First element contents 0x42C See previous line
Size of the 2nd element 0x42C + (size of the first element) 4
Second element contents ... ...

Table of pointers

Data Offset in file (in bytes) Size (in bytes)
Offset in the file of tile number n 0x424 + (size of the JFIF table) + n * 8 8

Remark: the pointers are not aligned. They are all eight bytes long, but they may start at an offset that is not a multiple of 8.

Tiles data

This is just a region of the memory that contains the tiles data, glued together (no alignment). So the data of tile number n ends where the data of tile n+1 starts.

I don't know yet how to choose which JFIF header to prepend to which tile.

Tiles numbering

Tile number 0 is the topleft tile of the maximum zoom level (the level in which the image is the largest). Tiles are then numbered, in this order, from left to right, from top to bottom, from the highest zoom level to the lowest.

Servlet API description

The ZoomifyServlet can take four arguments, passed as GET parameters:

  • file : the path to the pff file
  • vers : pff file version number
  • header : the size of the JFIF headers table
  • begin : a beginning offset in the pff file (in bytes)
  • end : end offset
  • requestType: see below

The requestType parameter

It can be 0, 1 or 2.

requestType = 2

Returns the metadata of the PFF file, in the following format: Error=0&newSize=124&reply_data=<PFFHEADER WIDTH="7312" HEIGHT="5288" NUMTILES="839" NUMIMAGES="1" HEADERSIZE="16342" VERSION="106" ZA="0" TILESIZE="256" />