Jump to content
Sign in to follow this  
PixelPerfect

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.

Share this post


Link to post
Share on other sites

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

Windows 10 Home, version 1909 (183623.476),
   Desktop: 16GB memory, Intel Core i7-6700K @ 4.00GHz, GeForce GTX 970
   Laptop:  8GB memory, Intel Core i7-3625QM @ 2.30GHz, Intel HD Graphics 4000 or NVIDIA GeForce GT 630M
Affinity Photo 1.7.3.481 and 1.8.0.514 Beta   / Affinity Designer 1.7.3.481 and 1.8.0.514 Beta  / Affinity Publisher 1.7.3.481 and 1.8.0.523 Beta

Share this post


Link to post
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.

Share this post


Link to post
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.
 

Share this post


Link to post
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.

Share this post


Link to post
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

Windows 10 Home, version 1909 (183623.476),
   Desktop: 16GB memory, Intel Core i7-6700K @ 4.00GHz, GeForce GTX 970
   Laptop:  8GB memory, Intel Core i7-3625QM @ 2.30GHz, Intel HD Graphics 4000 or NVIDIA GeForce GT 630M
Affinity Photo 1.7.3.481 and 1.8.0.514 Beta   / Affinity Designer 1.7.3.481 and 1.8.0.514 Beta  / Affinity Publisher 1.7.3.481 and 1.8.0.523 Beta

Share this post


Link to post
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

Windows 10 Home, version 1909 (183623.476),
   Desktop: 16GB memory, Intel Core i7-6700K @ 4.00GHz, GeForce GTX 970
   Laptop:  8GB memory, Intel Core i7-3625QM @ 2.30GHz, Intel HD Graphics 4000 or NVIDIA GeForce GT 630M
Affinity Photo 1.7.3.481 and 1.8.0.514 Beta   / Affinity Designer 1.7.3.481 and 1.8.0.514 Beta  / Affinity Publisher 1.7.3.481 and 1.8.0.523 Beta

Share this post


Link to post
Share on other sites
1 hour ago, walt.farrell said:

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

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).

Share this post


Link to post
Share on other sites
5 hours ago, walt.farrell said:

Instead of Saving a .afphoto file, you can Export a TIFF file with the Affinity layers saved.

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.

Share this post


Link to post
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

Windows 10 Home, version 1909 (183623.476),
   Desktop: 16GB memory, Intel Core i7-6700K @ 4.00GHz, GeForce GTX 970
   Laptop:  8GB memory, Intel Core i7-3625QM @ 2.30GHz, Intel HD Graphics 4000 or NVIDIA GeForce GT 630M
Affinity Photo 1.7.3.481 and 1.8.0.514 Beta   / Affinity Designer 1.7.3.481 and 1.8.0.514 Beta  / Affinity Publisher 1.7.3.481 and 1.8.0.523 Beta

Share this post


Link to post
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.

Share this post


Link to post
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"

Share this post


Link to post
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

Windows 10 Home, version 1909 (183623.476),
   Desktop: 16GB memory, Intel Core i7-6700K @ 4.00GHz, GeForce GTX 970
   Laptop:  8GB memory, Intel Core i7-3625QM @ 2.30GHz, Intel HD Graphics 4000 or NVIDIA GeForce GT 630M
Affinity Photo 1.7.3.481 and 1.8.0.514 Beta   / Affinity Designer 1.7.3.481 and 1.8.0.514 Beta  / Affinity Publisher 1.7.3.481 and 1.8.0.523 Beta

Share this post


Link to post
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)

Share this post


Link to post
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

Windows 10 Home, version 1909 (183623.476),
   Desktop: 16GB memory, Intel Core i7-6700K @ 4.00GHz, GeForce GTX 970
   Laptop:  8GB memory, Intel Core i7-3625QM @ 2.30GHz, Intel HD Graphics 4000 or NVIDIA GeForce GT 630M
Affinity Photo 1.7.3.481 and 1.8.0.514 Beta   / Affinity Designer 1.7.3.481 and 1.8.0.514 Beta  / Affinity Publisher 1.7.3.481 and 1.8.0.523 Beta

Share this post


Link to post
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

Share this post


Link to post
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. 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

These are the Terms of Use you will be asked to agree to if you join the forum. | 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.