Jump to content
You must now use your email address to sign in [click for more info] ×

100% image viewers support by using .af.png file format


Recommended Posts

Affinity files have previews, those previews are limited to 512x512 what is, to tell the truth, is not enough, also those previews are not displayed by operation system by default.

Some projects i'm working  on (UI-design) have hundreds of source files, and it is impractical to recognize those files only by filename or even lo-res preview :(

I really love approach Macromedia took with Fireworks file format, they made it so source-data appended to a png image file
all image viewers and file browsers recognize it as a picture and show high-resolution preview,
but editor knows that besides preview there is a source-data, and when you open that png in editor it is actually a vector source file

To remove confusion which png file is a flat raster image and which is a source file, extension suffix can be used kind of .af.png

A bit of technical details:
This is possible because of the patent-free nature of the PNG format, and it's chunk-based storage layer structure.
Data in png file is stored in "Chunks", chunks declare themselves as critical or ancillary, and a program encountering an ancillary chunk that it does not understand can safely ignore it.
So it is possible to put native affinity source file data into such chunk. Png serves as a container with nice cover image.

And what is the best part of this approach is this is very simple to implement - you get the best support by all image viewers, by simply gluing 2 files together.

Link to comment
Share on other sites

  • 1 month later...

My Windows 10 system shows previews of Affinity files. And it has been my understanding that Mac systems do, too.

Perhaps others have the same experience, and don't need better previews as you seem to need.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

Based on some of the hints I've seen from reading between the lines of some of the various issues and the like that have been identified related to the Affinity document file format, I don't think this would be as simple as you seem to think.

The Affinity document format seems to be structured more like a database file than a traditional document structure, and that might not play nicely with a tagged format like the ones you suggest, as the files might be updated constantly while they are open, not just when you explicitly save the document.

Link to comment
Share on other sites

1 hour ago, walt.farrell said:

My Windows 10 system shows previews of Affinity files.

Yes my as well, but those previews are limited to 500x500 pixels, way I suggest going to allow full-size previews

 
 
 
1
1 hour ago, fde101 said:

The Affinity document format seems to be structured more like a database file than a traditional document structure, and that might not play nicely with a tagged format like the ones you suggest, as the files might be updated constantly while they are open, not just when you explicitly save the document.

There is no need to change affinity file format structure, the only change is to add a wrapper
this is like a Christmas gift wrapped in a colorful paper, from outside you see the nice package, but inside it can contain anything

There is no need to regenerate high-res preview during work, only when the user explicitly asks to save a file.
 

Link to comment
Share on other sites

4 hours ago, PixelPerfect said:

way I suggest going to allow full-size previews

A full-size preview will also require full-size disk space, will take the full-size export time whenever saving the document, and this is in addition to the space already occupied by the file.  The Affinity team has already indicated that they designed the file format to optimize the speed of file operations, and this would not only contradict that purpose, but would also waste even more disk space where there are already people complaining that the files are sometimes too large.

I for one specifically do NOT want this.  Larger than 500 x 500 I could possibly live with, but the full resolution of my 20+ MPix camera?  No.

 

The size of the file is not constant either, and neither is the size of the suggested png "wrapper" - as a png file's size can vary even with the resolution being fixed, each time the file was saved there is the potential that the Affinity data might need to move within the file to accommodate changes to the size of the wrapper.  The files are not likely being rewritten in their entirety each time the document is saved, so this is potentially a much bigger change to the file format than you seem to realize.

Link to comment
Share on other sites

1 hour ago, Mark Ingram said:

We store a preview image in the file, for use with OS previews (so that we can quickly display the image, without having to render the entire document). 

PixelPerfect is asking (in part) for an option to have a larger preview image, Mark.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

On 10/23/2019 at 1:59 PM, PixelPerfect said:

A bit of technical details:
This is possible because of the patent-free nature of the PNG format, and it's chunk-based storage layer structure.
Data in png file is stored in "Chunks", chunks declare themselves as critical or ancillary, and a program encountering an ancillary chunk that it does not understand can safely ignore it.
So it is possible to put native affinity source file data into such chunk. Png serves as a container with nice cover image.

And what is the best part of this approach is this is very simple to implement - you get the best support by all image viewers, by simply gluing 2 files together.

In a way, what you're asking for is already available. Instead of Saving a .afphoto file, you can Export a TIFF file with the Affinity layers saved. That does the same thing you've described, but using TIFF rather than PNG format.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

1 minute ago, fde101 said:

You can also use the export persona to configure a png (or other format) and set up a "live" export as you modify the native file, and keep that next to the main file if desired.

Nice outside of the box thinking, leading to an out of the box solution :)

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

Just now, walt.farrell said:

outside of the box thinking

To a point...  the catch is that this would need to be set up for each file rather than something integrated into the document format itself.

 

Maybe a "save documents with large previews" option in preferences wouldn't be too bad of a thing to offer, but I definitely wouldn't want a "full size" preview of large documents saved in every file...

Meanwhile, this at least does exist.

Link to comment
Share on other sites

 

On 12/12/2019 at 2:29 PM, walt.farrell said:

In a way, what you're asking for is already available. Instead of Saving a .afphoto file, you can Export a TIFF file with the Affinity layers saved. That does the same thing you've described, but using TIFF rather than PNG format.

wow, didn't notice it before, maybe because export with "Save Affinity Layers" on is way more logical in "save as > TIFF" menu

yes, this is it!
the only thing is that PNG is way better-compressed format when TIFF files can get really huge PNG going to stay reasonably big

"Save Affinity Layers" checkbox for PNG export (what is a synonym for "save as PNG") going to make me happy

 

 
 
 
 
On 12/12/2019 at 8:34 PM, fde101 said:
To a point...  the catch is that this would need to be set up for each file rather than something integrated into the document format itself.
Maybe a "save documents with large previews" option in preferences wouldn't be too bad of a thing to offer, but I definitely wouldn't want a "full size" preview of large documents saved in every file...
Meanwhile, this at least does exist.

yes this is a good point, not always and not everyone needs a full-size preview
but an option to configure preview size would be a great thing to have

 

On 12/12/2019 at 4:22 PM, Mark Ingram said:

I know. But they're also asking us to change our file format to be PNG with our data embedded within it. What we currently have is our data with an embedded PNG in it (for the preview).

To be precise I was not asking to change or replace the affinity file format, I was proposing to add an option to save as "png with affinity layers"

Link to comment
Share on other sites

14 minutes ago, PixelPerfect said:

the only thing is that PNG is way better-compressed format when TIFF files can get really huge PNG going to stay reasonably big

TIFF supports compression, and Affinity supports multiple kinds of TIFF compression, found in the More... part of the Export dialog.

What will make it big is all the Affinity data that is being saved, too :)

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

7 minutes ago, walt.farrell said:

TIFF supports compression, and Affinity supports multiple kinds of TIFF compression, found in the More... part of the Export dialog.

yes TIFF supports ZIP and LZW both produce a worse result compared to PNG

as an experiment, i've saved same file 3 times:
afdesign with 500px preview - 735KB
png without layers data - 707KB
tiff with lzw compression and with layers - 1.6MB

if png with layers was possible it would be less than 1.4MB (full-size png preview + affinity layers - 500px preview)

Link to comment
Share on other sites

3 minutes ago, PixelPerfect said:

yes TIFF supports ZIP and LZW both produce a worse result compared to PNG

Perhaps, but you're also assuming the Affinity data would compress with the same efficiency as PNG data when using the PNG compression algorithms.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

5 minutes ago, walt.farrell said:

Perhaps, but you're also assuming the Affinity data would compress with the same efficiency as PNG data when using the PNG compression algorithms.

no layers data compression completely unrelated thing to preview compression, it is possible to embed whatever you want into a PNG file, any ZIP, RAR, ARJ or whatever affinity uses for compressing layer data

Link to comment
Share on other sites

2 hours ago, PixelPerfect said:

yes TIFF supports ZIP and LZW both produce a worse result compared to PNG

as an experiment, i've saved same file 3 times:
afdesign with 500px preview - 735KB
png without layers data - 707KB
tiff with lzw compression and with layers - 1.6MB

if png with layers was possible it would be less than 1.4MB (full-size png preview + affinity layers - 500px preview)

What was your source file? I'm not sure you're comparing like-for-like here, as in the afdesign file we will store vector info (i.e. small), in PNG you've rasterised and flattened, and with TIFF you've rasterised each layer. Without seeing your source file, I would say those results look expected. 

Link to comment
Share on other sites

52 minutes ago, Mark Ingram said:

What was your source file? I'm not sure you're comparing like-for-like here, as in the afdesign file we will store vector info (i.e. small), in PNG you've rasterised and flattened, and with TIFF you've rasterised each layer. Without seeing your source file, I would say those results look expected. 

ok, it was not fair enough as long as one of my layers was a raster
so here is a new test:
huge but simple file (attached) with 8 2048x2048 artboards - total area 9488x4509  (this is close to a maximum than I ever going to need as GUI designer)

afdesign with 500x500 preview:  39kb (yeah sure this is vector data it is tiny)
tiff - no layers: 1076 kb
tiff - with layers: 1085 kb (as expected only 9 kb of layer data )
png - no layers: 613 kb (as expected way smaller than tiff)
so if you supply a full-size preview PNG with layers data it is going to be 622 kb

and my point here is that png is a better format than tiff for this purpose

so 600kb for the full-size preview is awesome, I surely pay this 600kb to have a full-size preview,
yes this is easy to compress file, but even with most complex image compressed png of that size should not be ridiculously huge

test.afdesign

Link to comment
Share on other sites

Hi guys,

To be honest I do not understand most of the stuff you're talking about.

But it seems strange to me that larger preview / quick view of Affinity files would have to add much to the file size.

Check these two screenshots - afpub file has 5.5 MB and only this tiny preview where you cannot recognize anything. While the exported PDF from the same file has 570 KB and preview nearly for the full screen.

So I still don't get why Affinity files do not allow for these kind of previews.

D.

Screenshot 2019-12-17 at 00.18.42.png

Screenshot 2019-12-17 at 00.18.51.png

Link to comment
Share on other sites

  • 3 weeks later...
On 12/13/2019 at 12:42 PM, PixelPerfect said:

PNG is way better-compressed format when TIFF files can get really huge

PNG files do not support layers.

Neither does TIFF for that matter.

After embedding the entire document structure into the PNG file which does not natively support it, the PNG image data itself would basically need to be ignored when the Affinity products read the file back in, as I am sure they are doing with the TIFF files.

 

I suspect a more optimal end solution for this will be for Serif to release a scripting or plugin API powerful enough to automate setting up the export persona to maintain the PNG export next to the native Affinity document when one is saved, for those who want this capability.

Link to comment
Share on other sites

  • 1 month later...
On 1/3/2020 at 10:31 AM, fde101 said:

PNG files do not support layers.
Neither does TIFF for that matter.

Both PNG and TIFF support custom data blocks (you have to be a programmer to use that file format feature), and vector objects with layers is a data which can be stored inside that image file

This is like a postal envelope, from outside it looks like a rectangle of paper, but inside it can contain other pieces of paper with images, text or numbers.

All programs which do not understand that data will ignore it and recognize this file as a flat image, but editor which added that data going to recognize it and load as source file.

Link to comment
Share on other sites

1 hour ago, PixelPerfect said:

Both PNG and TIFF support custom data blocks

Correct.  I would guess that this is how the Serif products currently store the layer data inside the TIFF files, and in theory, the same should be possible for PNG...  that is kind of a given.

While I don't really care if they implement that option or not, I don't see the point of it either.

An option to include a larger preview thumbnail within the native document does seem like a very reasonable request, as long as it is in fact an option.  There could be choices like Small (128x128 or maybe 256x256), Standard (512x512), Large (2048x2048 or whatever), 10% of full size, 25% of full size, or full size, for example.

That said, for my purposes, I'm fine with it the way it is or however, as long as the documents are not significantly bloated by full-sized previews I don't really need, without an option to turn that off.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.