Learn the intricacies of optimizing pictures and images for the web using Photoshop, with a focus on the beneficial aspects of GIF and PNG compression for files with few colors or areas of flat solid color. Gain a detailed understanding of the steps involved in saving images as GIFs, and discover the similarities and differences between GIF and PNG-8 compressions.
Key Insights
- Files with few colors or areas of flat solid color are ideal for GIF or PNG compression, providing optimized results.
- Through the Photoshop tutorial, specific instructions are provided on how to save an image as a GIF, from cropping out empty pixels to make the file size smaller, choosing the right number of colors and color palette, to ensuring the transparency checkbox is checked.
- The GIF format reduces the file size by limiting the total number of colors in an image to a maximum of 256 colors.
- Three key color choices mentioned under GIF creation are 'Adaptive', 'Selective', and 'Perceptual', with 'Perceptual' providing the smallest file size without compromising the visual quality.
- Comparing GIF to PNG-8, it's found that while both compressions work similarly, PNG files are often smaller but not always, with the same settings, a PNG is typically 5-25% smaller.
- For web usage, it's advised to conduct a test and choose the format (GIF or PNG-8) that yields a smaller file size.
Discover how to optimize images through GIF or PNG compression in this detailed Photoshop tutorial, guiding you through the process of saving as GIF and comparing GIF to PNG-8 files.
This exercise is excerpted from Noble Desktop’s past Photoshop training materials and is compatible with Photoshop updates through 2020. To learn current skills in Photoshop, check out our Photoshop Bootcamp and graphic design classes in NYC and live online.
Topics Covered in This Photoshop Tutorial:
Comparing GIF & PNG, Transparency on the Web
Exercise Preview
Exercise Overview
Photographs and images with many colors optimize better as JPEGs, but files with few colors (or areas of flat solid color) are ideal for GIF or PNG compression.
Saving As GIF
From the Photoshop Class folder, open the file corporate-logo.psd.
-
Although this image is already in RGB mode at 72 ppi, we should crop out the empty pixels to make the file size smaller. We could use the Crop tool
and trim it manually, but there’s a better way. Go to Image > Trim and set the following:
Click OK, and Photoshop quickly and precisely trims the image for you!
Go to File > Export > Save for Web (Legacy).
-
In the settings on the right, from the menu below Preset, choose GIF.
The GIF format shrinks file size by reducing the total number of colors in an image. GIFs may have up to 256 colors, but generally you’ll need far fewer than that.
From the Colors setting on the right, choose 16 Colors.
-
From the menu to the left of Colors, choose the Perceptual color palette.
Adaptive, Selective, and Perceptual base their color choices on the actual image. The other options are preset color palettes and therefore are typically not desirable. We chose Perceptual in this case because it was the smallest file size, and visually there was almost no difference between the three options.
The Dither option uses scattered pixels to represent intermediate colors and often makes gradual blends look smoother. We don’t need that in this image, so in the menu immediately below Perceptual, choose No Dither.
-
From the Matte menu, choose whatever color you’d want to use as the background of your imaginary website (in this case, white).
GIF transparency does not allow for partial transparency. Therefore, any partially transparent pixels must become opaque. The Matte color is used as a background blend color for any pixels that are partially transparent in the original image. Choosing a color similar to your background allows the edges to better blend with the background of the webpage it will be used on.
Make sure that the Transparency checkbox is checked.
Choose the Zoom tool
on the left side of the window.
Click on the image to zoom in. The formerly translucent pixels around the edge of the logo have been blended with the Matte color to form completely opaque pixels!
Comparing GIF to PNG-8
GIF and PNG-8 compressions work almost exactly the same, but PNG is newer. PNG files are often smaller than GIFs but not always. Since all the settings are the same, we can do a quick test right now to see which is better for this graphic.
Take note of the GIF’s current file size.
In the settings on the right, from the menu below the Preset, change GIF to PNG-8.
Notice how the PNG is smaller? In our experience, a PNG with the same settings as a GIF is typically 5–25% smaller. For regular text, GIF is sometimes smaller, so you should typically do a test and go with whichever format yields a smaller file size.
-
Click Save and save it as yourname-logo.png in the Photoshop Class folder.
For more information about color palettes and the GIF, PNG, and JPEG formats, refer to the Web File Formats reference at the back of this workbook.