Image files are used to save fractal images which we have computed; but there is much more information which we typically want to save in practice, and keeping this co-ordinated with the image files can be a chore.

FracTest takes an innovative approach by saving all this information in one file, which can make life much easier. This page describes how it works.

When a fractal image is computed, we obviously want to be able to save it in a file. However, the image itself isn't much use for anything other than its looks; if you see an interesting saved image, and want to re-create it, for example to explore within the image, you would need to know the co-ordinates and other parameters it was created from. Even with the co-ordinates, we can re-render the image, but this might take a long time.

There are therefore many types of information we might wish to save, beyond just the computed image:

- the co-ordinates of the fractal view
- the parameters used to render that view; iterations, bailout, etc.
- the parameters of the generated image, such as size and resolution
- the palette used to colour the image
- the state of the computation of the fractal image

An innovation of FracTest is that it stores all of this information in
a single PNG**Portable Network Graphics**

Article on the PNG lossless image file format. [Wikipedia]

https://en.wikipedia.org/wiki/Portable_Network_Graphics file, every time you save
to a PNG file. This makes it very easy to explore on from a set of saved
images, as each image will contain
everything needed to re-create it efficiently. Since PNG is a
lossless format, this also acts as a perfect archive of the image
itself.

Since PNG files can be slow and unwieldy, FracTest also supports
exporting to the lossy JPEG**JPEG**

Article on the JPEG lossy image file format. [Wikipedia]

https://en.wikipedia.org/wiki/JPEG format, for
uploading to web servers and the like. However, the meta-data
described above is **not** saved
in JPEG files — since JPEG is lossy, it would be impossible to
accurately restore a computation state from it. So bear in mind
that JPEG files are for export only, not for your own image archive.

Since the saved PNG file contains all the related information about a fractal view, it can serve multiple purposes.

The simplest thing to use a PNG for is, of course, saving the generated fracal view itself. PNG Is excellent for this; as it saves images using lossless compression, the image is stored efficiently, but with absolutely no loss of quality.

Since the full view parameters are stored in each saved PNG file, re-creating the fractal view is as simple as loading the image file into FracTest. Since this gives us the full parameters, colour palette, etc., you can just use the controls to make derivations of that view; for example, re-framing, rendering at a different resolution, or zooming to explore further in.

A PNG file may contain the state of the computation which was in progress, or which had completed, when the image was saved. This state allows the pixel values stored in the image to be loaded into FracTest, even when only some pixels are valid (e.g. when the computation is incomplete, particularly with progressive rendering), so that they can be displayed without needing to be re-computed.

This allows two useful operations:

- a previously-computed fractal image can be loaded and displayed immediately, without being re-computed; and
- a partially-computed fractal image can be loaded and displayed, and then computation of it continued from where it left off.

This ability works particularly well with the history; stepping back and forth through the history, while displaying slow fractal images, allows work to continue at each step, rather than having to be re-started.

It is also essential for the checkpointing feature; if a calculation fails due to a crash, power cut, etc., it can be re-started from the last saved checkpoint.

Each PNG file contains the full specification of the colour palette used to create it; you can load this palette into your current view with the menu command "Palette" → "Load Palette". After loading, re-render to see the new view computed with the loaded palette.

With this feature in mind, PNG files can be used to store interesting palettes, with the image in each file serving as an example of its use.

Bear in mind that you may need to tune how the palette is applied to the view for good results.

Since JPEG is a lossy format, it would not be possible to restore a fractal computation from it. Also, it's not appropriate as an archive format for fractal images (it's great for photographs, which is what it was designed for). Hence, we do not store any meta-data (beyond the usual image meta-data) in a JPEG file; as a result, it will not be possible to re-create a fractal view from a JPEG file.

Since PNG is relatively slow, and the files can be large, we support export to JPEG format for uploading to web sites, and the like — JPEG is perfectly adequate for web viewing. Note that this is referred to as "export", rather than "save", to emphasise the difference. Your master copies of each generated fractal view should always be saved as PNG files.

Every time an image is saved to a PNG file, FracTest saves two sets of
meta-data along with it. In the standard meta-data "`tEXt`

"
chunk, we save all of the parameters used to create the image; and in a
non-standard "`ftCS`

" chunk, we save the states
of all the tiles used in the computation.

`tEXt`

" ChunkThe "`tEXt`

" chunk contains all the meta-data paramaters
describing how the view was created.

All of the the usual PNG meta-data is there as normal. Most of
the fields we create are prefixed "`fractal-`

",
except `Software`

, `Title`

, `Author`

,
and `Comment`

. The specific
fields saved vary by FracTest version, and also depend on whether the
render completed; but will typically include:

- Basic image meta-data:
`Software`

,`Title`

,`Author`

- A description of the render in
`Comment`

- Information about the meta-data itself:
`fractal-data-version`

,`fractal-data-precision`

- The basic fractal render parameters:
`fractal-formula, fractal-rep-func, fractal-maxiter, fractal-precision, fractal-bailout, fractal-centre-x, fractal-centre-y, fractal-radius-x, fractal-radius-y`

- Information on the configuration of the fractal calculation:
`fractal-config-`

*xxx* - Information on the colour palette used:
`fractal-palette-`

*xxx* - Information on the render modes used:
`fractal-render-`

*xxx* - Statistics about the render:
`fractal-stats-`

*xxx* - The Java date/time at which it was rendered (in ms since 1970):
`fractal-view-rendered`

A typical dump of this chunk will look like this:

Software: FracTest 13.0.10 Rev: 1901 in /D:/FracTest/bin
Title: Log
Author: clint
Comment: Render HD, precision HW, progressive THREE_PASS,
anti-alias OFF, cycle detect true, smoothing true
DONE: 100%, pass -1, 2,073,599 of 2,073,600 points, 5,533 in set,
3,328,822,862 iterations, 46,603,520,068 fp-ops, 4.28s,
11.4 GFLOPS Eff
fractal-data-precision: fx-11
fractal-data-version: 8
fractal-formula: mandel
fractal-rep-func: dwell
fractal-precision: hw
fractal-maxiter: 4000000
fractal-bailout: 2.0
fractal-centre-x: -0.080170666210932
fractal-centre-y: 0.656876784926575
fractal-radius-x: 4.83972E-10
fractal-radius-y: 4.83972E-10
fractal-config-aa: 1
fractal-config-need-bits: 41
fractal-config-pixels: 2073600
fractal-config-prec-bits: 53
fractal-config-prec-name: HW
fractal-config-tiles: 4860
fractal-palette: randomise
fractal-palette-huestep: 100
fractal-palette-rnd-hue: 130
fractal-palette-rnd-sat: 40
fractal-palette-rnd-val: 20
fractal-palette-sat: 120
fractal-palette-seed: 8
fractal-palette-segment: 24
fractal-palette-shift: 293
fractal-palette-size: 24
fractal-palette-space: hsv
fractal-palette-val: 240
fractal-render-aa: off
fractal-render-cycles: true
fractal-render-prog: three_pass
fractal-render-size: hd
fractal-render-smooth: true
fractal-stats-average-val: 1605.3355984760803
fractal-stats-compute-time: 22007
fractal-stats-cpus: 8.0
fractal-stats-efficiency: 0.6753928308372207
fractal-stats-elapsed-time: 4275
fractal-stats-flops-eff: 1.1442065936164988E10
fractal-stats-fpops: 46603534558
fractal-stats-in-set: 5533
fractal-stats-num-iters: 3328823897
fractal-stats-num-values: 2073600
fractal-stats-servers: 1.0
fractal-stats-smallest-val: 1031.9159440490482
fractal-stats-threads: 8.0
fractal-stats-tile-time: 1
fractal-stats-tiles-computed: 14580
fractal-stats-wallclock-time: 4073
fractal-view-rendered: 1515084400928

`ftCS`

" ChunkThe "`ftCS`

" (FracTest comp state) chunk is used to save the
state of the computation. This is basically a dump of the tiles configuration
(numbers and sizes of tiles), and the states of each tile. This is in an
internal format, which is likely to change between FracTest versions.

If the "`ftCS`

" chunk is missing, or is not compatible with
the current state of FracTest, then it is simply ignored, and the
image will be re-computed from scratch.

You can see the fractal parameters in the "`tEXt`

" chunk
of a PNG file with a tool which displays the PNG meta-data.

Unfortunately, a lot of tools, such as the Windows file properties
box, only show the most basic meta-data, and not the fractal parameters.
However, other tools can do it. For example, if you have
ImageMagick**ImageMagick**

An excellent set of command-line tools for image manipulation. [ImageMagick]

https://www.imagemagick.org/script/index.php, the following command
will work:

identify -verbose *file*.png

This will list all of the properties in the "`tEXt`

" chunk of
the given *file*.

Note that this method does not show the contents of the "`ftCS`

"
chunk used to store the computation state, or even its existence. Since
"`ftCS`

" is a non-standard chunk, no off-the-shelf tool will
display it.