JPG vs. PNG Within PlayCanvas

Hey all,

Curious about this line here on the optimization guidelines:

In general, prefer JPG format for textures over PNG.

Is this because when compressed, JPG’s are generally smaller or is there some optimization within the engine that makes PlayCanvas prefer JPG’s? I am putting some finishing touches on a project and am seeing some files that could potentially be made into JPG’s but the size difference between JPG and PNG in this case isn’t very large (like 1 KB or so).

Here are the optimization guidelines I am reading from: Optimizing Load Time | Learn PlayCanvas

That’s correct, yes

If you take the same RAW image and convert to JPEG and PNG, JPEG is more likely to be smaller

I also recommend using https://tinypng.com/ to compress even more with minimal quality loss

3 Likes

Okay so if there is not a size difference, there is not a reason to switch to JPG from PNG? The only reason I could even think of is so that the engine wouldn’t have to compute anything on the alpha channel but I’m not sure if that is even true.

Also yes, tinypng is amazing :slight_smile:

Another thing to keep in mind with PNG files that include alpha is they occupy more video memory.

So if that alpha channel isn’t used, your app will have higher memory footprint in the case of png files.

1 Like