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.
Note: These materials are provided to give prospective students a sense of how we structure our class exercises and supplementary materials. During the course, you will get access to the accompanying class files, live instructor demonstrations, and hands-on instruction.
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.