Use of PNGs in After Effects

To talk about anything else
User avatar
D.T. Nethery
Posts: 4225
Joined: 27 Sep 2006, 19:19

Re: Use of PNGs in After Effects

Post by D.T. Nethery »

Jeremy Richard wrote: 20 Jun 2023, 22:25 Thank you.

Chris Zwar, who I quoted in the first post of this topic, came back on the subject in a video about the benchmark he did regarding png performances in After Effects.
The video was very interesting.

He makes a solid case that PNGs are definitely slower for rendering.

The main reason for using PNGs that was given to me years ago is that the PNG file format is lossless, so the image quality would supposedly be better overall than with a lossy format like JPEG. But then TIFF is also a lossless format. However , Chris Zwar's tests demonstrate that TIFF is much faster than PNG. So TIFF and PNG should be equivalent quality , but TIFF is faster. ProRes 4444 while technically "lossy" , always looks very good to my eyes. Although I will say that in exporting animation from TVPaint as ProRes 4444 .mov files with transparent alpha channel for compositing in After Effects I have had times where certain types of images looked bad. For example , images that have a semi-transparent edge, such as shadows or glows (any kind of gradient) don't look as good when they get into After Effects if they are ProRes .mov files vs. PNG image sequences.

Animator, TVPaint Beta-Tester, Animation Educator and Consultant.
MacOS 12.7.1 Monterey , Mac Mini (2018) , 3.2 GHz 6-Core Intel Core i7,
16 GB RAM , TVPaint PRO 11.7.1 - 64bit , Wacom Cintiq 21UX 2nd Gen.
,Wacom Intuos Pro 5 , Wacom driver version 6.3.39-1
User avatar
mox
Posts: 1024
Joined: 13 Feb 2006, 19:24
Contact:

Re: Use of PNGs in After Effects

Post by mox »

For PNGs in TVP, you can choose a compression ratio from 1 to 10 (5 by default I guess): the picture will be always lossless but the file size will be different (and it will impact a lot when decompressing for memory/cpu).
Does the guy say at one point what kind of compression he uses for PNGs? I don't see any info about it in the video.
Jerome Lorin
Moxica (playground)
(Win11/TVP 11.7.3-64 bits pro)
User avatar
D.T. Nethery
Posts: 4225
Joined: 27 Sep 2006, 19:19

Re: Use of PNGs in After Effects

Post by D.T. Nethery »

mox wrote: 21 Jun 2023, 10:03 For PNGs in TVP, you can choose a compression ratio from 1 to 10 (5 by default I guess): the picture will be always lossless but the file size will be different (and it will impact a lot when decompressing for memory/cpu).
Yes, this is true and it has a significant impact on the file sizes of the exported PNGs.

I usually compress my PNGs exported from TVPaint at the default setting of 5.
TVPaint PNG_export_settings.png
TVPaint PNG_export_settings.png (38.39 KiB) Viewed 13864 times

I know you know this , mox, but for the benefit of anyone on this forum who is reading this discussion in the future, when exporting PNGs from TVPaint the export setting of 1 is the fastest export speed , but the file sizes are larger. The PNG export setting of 10 is slowest for export , but the file sizes are much smaller. The middle setting of 5 is a reasonably fast export time and and the file sizes are not too large, so I usually just leave it set on 5. One would expect that using the middle setting of 5 would mean that the file size would be half-way between the size of the fastest setting of 1 and the slowest setting of 10 , but in my experience 5 tends to be closer to 10 in file size , while the PNG export setting of 1 makes a significantly larger file size. For example, I just now made a test of exporting a single image: at the setting of 1 (fastest export) the file size is 33.2 MB . At the setting of 10 (slowest export) the file size is only 3.5 MB (9.5x smaller ). At the export setting of 5 the file size is 4.3 MB. (about 7.7x smaller than the largest size of 33.2 MB).

So, PNGs exported at the fastest export setting of 1 will be 9x - to - 10x larger than PNGs exported at the slowest export setting of 10 .

mox wrote: 21 Jun 2023, 10:03 Does the guy say at one point what kind of compression he uses for PNGs? I don't see any info about it in the video.
That is a question worth asking . I plan to email him to ask about that.

This is why until this point I have continued to use PNGs because if I export PNGs from TVPaint at the setting of 5 (medium) or 10 (slow) the file sizes are smaller than uncompressed LZW (lossless) TIFF files. In comparison to the PNG file sizes for my test export , the TIFF file is 6.3 MB compared to 3.5 MB (PNG export setting 10) or 4.3 MB (PNG export setting of 5). The same image exported as TGA was 12.3 MB.

But now that I am delving into this a bit deeper by carefully reading the articles by Chris Zwar, I wonder if even with the smaller file sizes if perhaps the PNG file format is not optimal for use in After Effects ? If using TIFF files speeds up the rendering process in After Effects as Chris Zwar suggests, then maybe better to switch to TIFF.

However, overall image quality is an important factor, so if lossless PNGs result in a sharper image quality and better color fidelity , I would tend to stick with using PNGs even if render times are slower. But if TIFF (which is also lossless) gets the same results as PNG and has faster render times from After Effects, I will switch to TIFF. (or perhaps EXR , if TVPaint adds EXR as an export option). Chris Zwar's tests indicate that using MOV files with Apple ProRes 4444 compression are even faster than using TIFF image sequences, but as I mentioned in my previous post I have experienced some odd behavior from MOV files exported from TVPaint using FFMpeg ProRes codec. Often I have noticed animated elements with transparent edges such as soft shadows, glows, or gradients will tend to have a visible "edge" around the transparent area when they are imported into After Effects. That ugly, visible edge is not visible if the same elements are imported as transparent PNGs. Animated elements that have a hard, opaque edge seem to do fine as MOV files exported with ProRes compression codec.
Last edited by D.T. Nethery on 23 Jun 2023, 11:03, edited 3 times in total.

Animator, TVPaint Beta-Tester, Animation Educator and Consultant.
MacOS 12.7.1 Monterey , Mac Mini (2018) , 3.2 GHz 6-Core Intel Core i7,
16 GB RAM , TVPaint PRO 11.7.1 - 64bit , Wacom Cintiq 21UX 2nd Gen.
,Wacom Intuos Pro 5 , Wacom driver version 6.3.39-1
User avatar
mox
Posts: 1024
Joined: 13 Feb 2006, 19:24
Contact:

Re: Use of PNGs in After Effects

Post by mox »

Very wise to write it down, it's quite easy to mix up "file size" compression and "picture aspect" compression (leading to artefacts such as .JPGs).

At one point I know developers rather did use uncompressed TGAs vs PNGs because it was quicker to handle, memory-wise (but assets pack was bigger).
Now with powerful CPU+GPU, I thought this kind of optimization was from another era, so it's intriguing :]

About edges issue, I maybe totally wrong but only alpha with 'premult' is available for .MOV, and it tends to be a bad thing for every kind of format, it's way better to switch to 'No Premult' as far as possible.
Jerome Lorin
Moxica (playground)
(Win11/TVP 11.7.3-64 bits pro)
User avatar
D.T. Nethery
Posts: 4225
Joined: 27 Sep 2006, 19:19

Re: Use of PNGs in After Effects

Post by D.T. Nethery »

mox wrote: 21 Jun 2023, 16:44 About edges issue, I maybe totally wrong but only alpha with 'premult' is available for .MOV, and it tends to be a bad thing for every kind of format, it's way better to switch to 'No Premult' as far as possible.
It appears that only AVI in RGBA mode allows for switching to 'No PreMult' option.

AVI_TVPaint_Export_NoPreMult.png

Exporting to AVI in RGBA mode with 'No Premult' makes the file size about 20x larger (!) than exporting to ProRes with 'PreMult'.

Animator, TVPaint Beta-Tester, Animation Educator and Consultant.
MacOS 12.7.1 Monterey , Mac Mini (2018) , 3.2 GHz 6-Core Intel Core i7,
16 GB RAM , TVPaint PRO 11.7.1 - 64bit , Wacom Cintiq 21UX 2nd Gen.
,Wacom Intuos Pro 5 , Wacom driver version 6.3.39-1
User avatar
Dean
Site Admin
Posts: 1034
Joined: 28 May 2018, 09:07

Re: Use of PNGs in After Effects

Post by Dean »

D.T. Nethery wrote: 20 Jun 2023, 22:47 Hi, Dean ,
What was the outcome of your discussion with the developers about adding support for exporting to EXR files from TVPaint to After Effects ?
Hi David, apparently including the EXR format for export would bring no improvement for the 8 bit sRGB images that TVPaint outputs, but it could have other uses so more investigation must be conducted.
Probably a vampire
User avatar
Jeremy Richard
Posts: 53
Joined: 16 Oct 2021, 01:44
Contact:

Re: Use of PNGs in After Effects

Post by Jeremy Richard »

Dean wrote: 22 Jun 2023, 12:06 it could have other uses so more investigation must be conducted.
An EXR file can be multilayered, it could possibly be used to export the equivalent of 3D render passes, where in one file we'll have our line layer, shadow layer, highlight layer and so on.

The plugin ProEXR allows that in After Effects.

The JPEG XL format also has that multi layer ability.
User avatar
D.T. Nethery
Posts: 4225
Joined: 27 Sep 2006, 19:19

Re: Use of PNGs in After Effects

Post by D.T. Nethery »

If exporting images to TIFF format for use in After Effects (as David Zwar recommends, instead of PNG) , what TIFF compression is optimal for AE ?

TVPaint offers these options for TIFF:

None
LZW
PackBits
JPG


For use in After Effects does anyone know the difference and the advantages/disadvantages of using one or the other of these compression options for TIFF ?

In a test I did there was no difference in file size of an image exported to TIFF with None , LZW , PackBits, JPG compression options. The file size was 780 KB for each.

TVPaint TIFF exports_same_file_size.png
TVPaint TIFF exports_same_file_size.png (32.12 KiB) Viewed 13705 times
TVPaint_TIFF_Export_Options.png
----------


I ran some further tests. I created a short sequence of animation, 50 frames in length, at HDTV UHD 4K 3840 x 2160 resolution. Here are the sizes of the exported files using different image formats:

Image Sequences:

PNG v1 - 173.2 MB (this was using compression setting 10 , the slowest export speed, but resulting in the smallest file sizes)

PNG v2 - 199.7 MB (using compression setting 5 , the mid-range export speed , resulting in slightly larger file sizes)

TIFF (LZW) - 307.4 MB

TIFF (PackBits) - 307.4 MB (no difference from TIFF LZW compression.)

TGA - 578.1 MB

PNG v3 - 1.69 GB (using compression setting 1 , the fastest export speed , but resulting in much larger file sizes)


Video files:

MOV (RGBA, ProRes 4444) - 64.6 MB

MOV(RGBA, Lossless PNG) - 173 MB

AVI (RGBA) - 1.66 GB



So , exporting to PNG using compression setting from 5 - to - 10 results in smaller file sizes than using TIFF or TGA , but if there are other factors at play beside the file sizes (i.e. if PNG is simply not optimized for fast rendering in After Effects) then it may be better to use TIFF (per David Zwar's recommendation) or TGA (per Hironori Takagi's recommendation). TIFF and TGA may be larger file sizes , but if they load and render faster in After Effects then they would be preferable. Hironori Takagi wrote: "This is the reason why targa (TGA) has been the standard in Japanese animation production for nearly 20 years. Experience has shown that PNG takes a long time to encode and decode, causing slowness in Adobe applications." )

Export to MOV with ProRes 4444 (lossy) codec results in the smallest overall file size.

Export to MOV with Lossless PNG codec is equivalent to exporting to PNG image sequence with compression setting 10 .

Export to AVI RGBA mode (for transparency) results in a significantly larger file size (1.66 GB) than the other formats.


I would be inclined to use MOV with ProRes 4444 codec , except in the case where animation layers have transparent edges for shadows, glows , or any sort of transparent gradient , because in my experience these layers will tend to have a noticeable edge around them when imported into After Effects.

Animator, TVPaint Beta-Tester, Animation Educator and Consultant.
MacOS 12.7.1 Monterey , Mac Mini (2018) , 3.2 GHz 6-Core Intel Core i7,
16 GB RAM , TVPaint PRO 11.7.1 - 64bit , Wacom Cintiq 21UX 2nd Gen.
,Wacom Intuos Pro 5 , Wacom driver version 6.3.39-1
User avatar
Dean
Site Admin
Posts: 1034
Joined: 28 May 2018, 09:07

Re: Use of PNGs in After Effects

Post by Dean »

Interesting. According to an old French forum post I found, LZW seems more adapted for cartopgraphic images (so flat colors).
The first 2 algorithms are "lossless", but the absence of a difference in file size is intriguing. Maybe they should be tested with more visually complex projects.

Edit: I didn't see that David modified his post before sending my response. Thank you for these additional tests
Probably a vampire
User avatar
D.T. Nethery
Posts: 4225
Joined: 27 Sep 2006, 19:19

Re: Use of PNGs in After Effects

Post by D.T. Nethery »

Here is another test I made:

I used a small TVPaint project with a total of 62 frames . The project has 11 layers of animation.

TEST 1-
Export to JSON as TIFF image format. (LZW compression) The export took 1 minute to finish. The overall folder size with all TIFFS is 393.8 MB

TEST 2 -
Export to JSON as PNG image format (PNG compression of 5 - the medium export time) ) . The export took 4 minutes to finish (so 4x longer than TIFF) The overall folder size with all PNGS is 76.3 MB

So , even though TIFFS are much larger overall file sizes than the PNGs exported at setting of 5 , the export was 4x faster using TIFF than using PNG.


TEST 3 -
Export to JSON as PNG image format (PNG compression of 1 - the fastest export time). The export took 2 minutes to finish (so 2x longer than TIFF) The overall folder size with all PNGs s 5 GB.

(Wow ! 5 GB with PNG compression of 1 , compared to only 76.3 MB with PNG compression setting of 5 . But only gaining 2 minutes of faster export time. The huge increase in the file size when using PNG compression of 1 doesn't seem right . Is this a bug when using PNG compression for export to JSON ? )

Animator, TVPaint Beta-Tester, Animation Educator and Consultant.
MacOS 12.7.1 Monterey , Mac Mini (2018) , 3.2 GHz 6-Core Intel Core i7,
16 GB RAM , TVPaint PRO 11.7.1 - 64bit , Wacom Cintiq 21UX 2nd Gen.
,Wacom Intuos Pro 5 , Wacom driver version 6.3.39-1
nehavilash
Posts: 9
Joined: 29 Dec 2023, 10:59
Contact:

Re: Use of PNGs in After Effects

Post by nehavilash »

I recommend using TIFF for lossless quality with faster rendering compared to PNG. chris zwar benchmark video highlights the efficiency of TIFF over PNG in rendering. For transparent alpha channel, ProRes 4444 is a good alternative with impressive visual quality, on the other hand you can compress these images through online application such as jpeg compressor it supports other type of format without losing their quality.
User avatar
D.T. Nethery
Posts: 4225
Joined: 27 Sep 2006, 19:19

Re: Use of PNGs in After Effects

Post by D.T. Nethery »

D.T. Nethery wrote: 28 Jun 2023, 15:14 TEST 3 -
Export to JSON as PNG image format (PNG compression of 1 - the fastest export time). The export took 2 minutes to finish (so 2x longer than TIFF) The overall folder size with all PNGs s 5 GB.

(Wow ! 5 GB with PNG compression of 1 , compared to only 76.3 MB with PNG compression setting of 5 . But only gaining 2 minutes of faster export time. The huge increase in the file size when using PNG compression of 1 doesn't seem right . Is this a bug when using PNG compression for export to JSON ? )

TVPaint developers: did you see my post above regarding the huge file size of PNG compression at setting 1 (fastest compression time/largest file size) , but only gaining 2 minutes of faster export time over using the "medium" compression setting of 5 ,which makes much smaller file sizes?

My question was: Is this a bug when using PNG compression for export to JSON ? .

It doesn't matter to me too much because based on my own tests I will use the much faster export to TIFF from now on, but sometimes clients specifically request that image sequences be delivered in PNG file format, so this seems like a bug in TVPaint's PNG export settings that should be fixed.

Animator, TVPaint Beta-Tester, Animation Educator and Consultant.
MacOS 12.7.1 Monterey , Mac Mini (2018) , 3.2 GHz 6-Core Intel Core i7,
16 GB RAM , TVPaint PRO 11.7.1 - 64bit , Wacom Cintiq 21UX 2nd Gen.
,Wacom Intuos Pro 5 , Wacom driver version 6.3.39-1
User avatar
Dean
Site Admin
Posts: 1034
Joined: 28 May 2018, 09:07

Re: Use of PNGs in After Effects

Post by Dean »

Hello David, this is something that will be discussed again during v12's life cycle, as it won't make it to v12.0.
Probably a vampire
User avatar
D.T. Nethery
Posts: 4225
Joined: 27 Sep 2006, 19:19

Re: Use of PNGs in After Effects

Post by D.T. Nethery »

Dean wrote: 01 Feb 2024, 15:22 Hello David, this is something that will be discussed again during v12's life cycle, as it won't make it to v12.0.
I still hope that PNG export settings can be fixed as soon as possible. (it's not a minor bug, because some clients specifically ask for image sequences delivered as PNGs, even though all testing suggests that TIFF or TGA is better.)

I notice with Photoshop the difference between using their Smallest File Size (slowest to save) and Large File Size (fastest to save) settings doesn't have as great a difference in file size as TVPaint. A test using Photoshop's Smallest File Size setting resulted in an image size 5.7 MB and the Large File Size was 6.6 MB.

Photoshop PNG_Export_Settings.jpg
Photoshop PNG_Export_Settings.jpg (39.99 KiB) Viewed 6885 times

Whereas the same image saved from TVPaint results in file size of 33.2 MB (Setting 1 = largest file/fastest save) vs. 4.9 MB (Setting 10 = smallest file/slowest save). That's a HUGE disparity.

(TVPaint does better compressing at the smallest file size setting: TVPaint 4.9 MB vs Photoshop's 5.7 MB , but at the larger file size setting TVPaint's 33.2 MB vs. Photoshop's 6.6 MB) .

TVPaint_PNG_Export_Settings.jpg

Animator, TVPaint Beta-Tester, Animation Educator and Consultant.
MacOS 12.7.1 Monterey , Mac Mini (2018) , 3.2 GHz 6-Core Intel Core i7,
16 GB RAM , TVPaint PRO 11.7.1 - 64bit , Wacom Cintiq 21UX 2nd Gen.
,Wacom Intuos Pro 5 , Wacom driver version 6.3.39-1
Post Reply