# File Format Extensions

# File Format Extensions

These extensions allow Imaging to load and save images from/to files in various formats. File formats included in Imaging core (that is in Source directory) must satisfy these requirements: both loading and saving support, native crossplatform Object Pascal implementation, support as many data formats as possible, be stream safe (you have multiple images in one stream and you load them one by one without exactly knowing where they start - after loading one stream position must be precisely at the beginning of another - some file formats (e.g. Daggerfall images) need to know exact file size during loading so they are inherently unsafe). File format loaders/savers that do not meet these requirements are located in Extras package (Extras\Extensions directory).
Some complex file formats make compiled binaries significantly larger. Most notably TIFF (around 400 KiB), JPEG (around 100 KiB), JPEG2000 (around 150 KiB), and PNG (around 50 KiB). Some formats use others internally - MNG and JNG use PNG and JPEG. If you know you won't be needing some of those formats and you don't want large binaries you can disable them at compile stage.

This is done by uncommenting DONT_LINK_* (where * is file format identifier) symbols in ImagingOptions.inc include file located in Source directory. All core file formats have corresponding symbols here and all are enabled by default in this include file.

There is also DONT_LINK_EXTRAS symbol that controls automatic linking with file formats declared in Extras package (individual DONT_LINK_* symbols for these file format can be turned on/off in ImagingExtras.pas unit located in Extras\Extensions directory).
In Imaging 0.26.2 file format linking symbols were changed from LINK_* to DONT_LINK_*. So if you used these symbols somewhere in you projects please check your code if it still works as intended after 0.26.2 installation.
Why did it change?
Since all formats are enabled by default in Imaging releases, if you wanted to disable one format you had to manually edit ImagingOptions.inc and comment out appropriate $DEFINE statement. So there was a problem when you had more projects using the same Imaging installation and each wanting to use different subset of file formats. With new symbols you don't have to edit the include file at all, just add DONT_LINK_* to "Conditional defines" (or its Lazarus equivalent) in compiler options of each project.

## More on supported file formats

Supported File Formats