Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Design Photoshop Foundations Slices & Save for Web Optimization: Part 1

Yuqi Feng
Yuqi Feng
4,686 Points

JPG vs. PNG 24

So JPG is lossy and PNG 24 is lossless. Then why is JPG but not PNG 24 best for photographs? Also, in what situation should I use JPG instead of PNG 24? It sounds like PNG 24's only downside is the size. Thanks!

1 Answer

Damien Watson
Damien Watson
27,419 Points

Hi Yuqi,

It really depends what you are using the image for. With web the smaller file size the better, faster load times, smaller data usage etc. JPG is lossly, but you're not dealing with print and there is a certain level of 'dodgy' that is acceptable for a greatly decreased file size. I start at 100% compression and pull it down until there is a balance with file size and quality, you'd be surprised at how small some files can go.

I tend to only use 24bit(32bit) PNG if transparencies are required, 8bit if logos or flat shades.

Hope this helps clarify a bit.

You may want to correct: "JPG is lossless," in your answer above. JPG employs a lossy compression scheme as it looses data when going for the lower size for the final output file.

Damien Watson
Damien Watson
27,419 Points

Cheers Andrei, brain fade. :)