Image formats that support layers

I am relatively new to the concept of layers in image editing software. If I understand correctly, some image/file formats such as Paint.NET's .pdn or Photoshop's .psd support layers, but others such as .bmp or .jpeg don't.

I was wondering if anybody knows of an image file format that supports layers and that is relatively "open", in the sense that can be opened in different image editors (preferably lightweight and non-proprietary software) and for which read & write code libraries (e.g. in Python, C, C++, MATLAB) exist.


Solution 1:

TIFF can contain layers. This format should be supported by almost all image viewers.

Solution 2:

If you don't need raster support in the representation, but only in the resulting files, try SVG format with rendering down to whatever raster format when needed.

http://www.w3.org/Graphics/SVG/

Solution 3:

In a practical sense, .psd (photoshop) is going to be the most portable format with the widest reach and most implementations, despite it not being "open".

Solution 4:

I know it's old question, but it's still relevant after all those years.

Try OpenEXR it's production proven standard in VFX industry, fully open sourced. Widely supported by many applications (Adobe After Effects, Nuke, Krita, Blender...), just Adobe Photoshop support is not very good.