the file format
There are couple of file patterns through the Lytro library, depending on your platform and version:
raw.lfp (IMG_0000.lfp)
These are the raw files from camera. They contain:
- Raw Sensor Data component
The Lytro A01 camera generates 3,280 px × 3,280 px × 12-bit data. To save space, the pixel values are packed together instead of padded, so there are 2 pixels (24 bits) stored in 3 bytes. Hence the length of this component in this case is always 16,137,600 bytes.
For example, if you have one white pixel (FFF) followed by a black one (000), there will be FF F0 00 in raw data. Also, the values are stored in big endian order. So 12 34 56 need to be decoded into 03 12 06 45. The first pixel is the top left one, continuing in rows.
Do not forget that the resulting image is grayscale with Bayer color filter over it, so it needs to be demosaiced to obtain the color information.
- Frame Metadata component
This metadata contain all information needed to reconstruct the image. That includes the way how the Raw Sensor Data component is encoded (so that data from other cameras/applications can be processed), readings from sensors (time in Zulu zone, temperatures of main board and lens, accelerometer, camera orientation), hardware configuration (parameters of sensor, microlenses, lens, camera maker and model), photo parameters (shutter, iso, zoom, creative mode) and the firmware version.
As all metadata, this component is in the JSON text format.
- Private Metadata component
Imaging sensor serial number and camera serial number is the only information here.
As all metadata, this component is in the JSON text format.
The package metadata contain the metadata version, references to all the above components and whether the picture was marked as favorite. Also whether the image is a dark or modulation frame (only calibration images do have these set).
stack.lfp, stacklq.lfp (IMG_0000-stk.lfp)
These files are generated by the Lytro desktop software during importing pictures from a camera. They are considerably smaller (rarely above 1 MB) and they are the files used if you share the picture with someone using the software. Components:
- One or more prerendered images
In older versions and in the case of low quality (stacklq.lfp) files, they are stored as simple JFIF images (i.e. JPEG), focused at different depths. They are of 1080 × 1080 pixel resolution (330 × 330 in case of stacklq).
Recently, stack.lfp started encoding the images into a H.264 Annex B stream to further decrease the file size. You can still get full resolution separate images stack using the export command in the Lytro desktop.
The files for sharing do not contain the whole light field data, just couple of standard images which were prerendered at the depths the software thought the user might want to refocus to (and perspective shift views if enabled).
- Depth Lookup Table component
This is array of doubles representing the depths at which the image should be refocused if user clicks at the corresponding position.
Older Lytro desktop divides the picture into 20 × 20 areas for which the depth is specified. Thus, there are 400 doubles in total, i.e. 1,600 bytes for this component. The newer version divides the picture into 330 × 330 areas, significantly increasing the map resolution (108,900 doubles in total / 435,600 bytes for component), needed for the interactive filters. To get finer depth map for your old pictures, just import the raw image into the new Lytro desktop.
The first depth is the top left area, continuing in rows.
The package metadata contain the metadata version, reference to the lookup table and references to all the prerendered images with a depth they represent, so that the viewers can just show the correct image. The only other metadata included is whether the image was marked as favorite (and dark/modulation, see above), specially, there is no information about when the picture was taken, the caption that it was given, its iso, shutter speed etc. in the files published online.
stack_filtered.lfp, stacklq_filtered.lfp
The same files as above, except that the selected filter is applied to the prerendered images.
dm.lfp (IMG_0000-dm.lfp)
This is separate file containing depth map only. Components:
- Depth Lookup Table component
See the previous description, it is the same component.
- Depth Confidence Table component
This component is provided only by the newer Lytro desktop software. The component structure is the same as the depth lookup table, but the values
express confidence ranging from 0 (not confident) to 1 (confident) of the depth value located at the same place in the lookup table. The depth values are computed from the light field and as such might and cannot always be 100% correct.
data.C.#
These are just packages for other files, as noted in the backup.
The package metadata contains list of file names present in the package and references to them, with an optional information which package file to continue with (since the generated packages tend to not have much more than 256 MB). Then, the files themselves are the individual components of the package.
On Windows, these files can be found at %LOCALAPPDATA%\Lytro\cameras\sn-##########. On Mac, they are in the package at Lytro.lytrolib\cameras\sn-##########.
*.calib
Newer Lytro Desktop versions drop further calibration data into %LOCALAPPDATA%\Lytro\cameras\ folder, containing H.264 encoded bitmap groups for calibrating the compression algorithm. Note that these files, perhaps due to an error, must be preprocessed to become valid packages, by changing all CR LF bytes to LF.
the specification
As noted above, the packages consists of components, laid one after other. The specification of each component is as follows:
89 L F _ 0D 0A 1A 0A VE VE VE VE CL CL CL CL (header with component type, version?, data length)
s h a 1 - 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 (component name)
__ __ __ __ __ __ __ __ __ __ __ __ 00 00 00 00 (component data, null padding)
bytes | notes |
0‑7 | Constant 8 bytes header, the fourth byte determines the component type, which can be one of these:
- P (package), always the first component in the file
- M (metadata), in Lytro files always the second component in the file and always the only one
- C (component), any other component
This makes the file easily identifiable as the first line always reads ‰LFP when opened in a text editor.
|
8‑11 | Probably version of the file format specification, big endian integer. Currently all Lytro files have 00 00 00 01, but only in the first (i.e. LFP) component. Other components have 00 00 00 00. |
12‑15 | Length of data in the component, big endian integer. This value can be zero, in which case this is the end of the component and the next component follows immediately. Currently the LFP component has always zero length. |
16-96 | Name of the component. The name can have up to 80 bytes, shorter names are padded with zeros to the total length of 80. Several components can have the same name. Lytro chose to name all components using the SHA1 hash of the component data. For example, the component containing CALIB\HW_VERSION.TXT from the backup has the name “sha1-0ebc94cc825e8c4c1defb3e5c0ca5ae5e7be0620”. Yes, all hash functions have collisions, but as noted the name is not required to be unique. |
97‑ | The actual data of the component. Length of data is specified by the number at bytes 12‑15. |
* | Every component is padded with zeros so that the total length of the component (i.e. header + version + data length + name + data + padding) is multiple of 16. If the sum without padding is already a multiple of 16, then no padding is added. |
The files do not have any special opening or closing.
Disclaimer: Jan Kučera and miloush.net are not affiliated with or endorsed by Lytro, Inc. and the above information is not confirmed.