Keeping GIF File Size Down

Free Photoshop Tutorial

Dive into this comprehensive Photoshop tutorial, exploring advanced animation techniques such as tweening multiple parameters and reducing file sizes.

This exercise is excerpted from Noble Desktop’s past Photoshop Animated GIFs training materials and is compatible with Photoshop updates through 2019. 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:

Tweening multiple parameters, Tips & tricks for reducing file size, Reworking the animation to reduce file size

Exercise Preview

ex prev NAPS done 1

Exercise Overview

In this exercise, we will continue to work with tweening by completing a more complex animation. You’ll learn how to tween multiple parameters as well as tips and tricks for reducing file size.

Adobe Photoshop Bootcamp: Live & Hands-on, In NYC or Online, Learn From Experts, Free Retake, Small Class Sizes,  1-on-1 Bonus Training. Named a Top Bootcamp by Forbes, Fortune, & Time Out. Noble Desktop. Learn More.

Previewing the Finished Animation

Let’s start by previewing how our finished file will look at the end of this exercise.

  1. Launch any web browser (Chrome, Safari, Firefox, etc.).

  2. Press Cmd–O (Mac) or Ctrl–O (Windows) and navigate to Desktop > Class Files > Animated GIFs Class > NAPS.

  3. Double–click on NAPS-1.gif.

    Watch the animation loop a few times to get a feel for what we’ll be working towards. The animation starts with a silhouette of someone taking a nap moving up onto the screen and fading in, followed by some text. The whole scene then fades to teal, the NAPS logo fades in, and a Join Now button appears.

Getting Started

  1. In Photoshop, go to File > Open.

  2. Navigate into Desktop > Class Files > Animated GIFs Class > NAPS and open NAPS.psd.

  3. If you get a message about Text Layers needing to be updated, click Update.

  4. Go to File > Save As.

  5. Name the file yourname-NAPS.psd and navigate into Class Files > Animated GIFs Class > NAPS.

  6. Click Save.

  7. We built some of the animation for you to save time. At the bottom of the Timeline panel, click Play play button to preview the animation so far. We’ve animated in all the elements for the first part of the animation, but need to transition to the second part of our animation and fade in our logo and button. Click Stop stop button when you’re done.

Tweening Multiple Parameters

Let’s create the rest of the animation. Instead of jumping from one set of images to another, we’re going to fade things out as they move off-screen. We will accomplish this by changing the opacity and position of the elements, and use Tweening to have Photoshop create all the in-be“tween” steps for us.

  1. Select frame 14.

  2. In the Layers panel, show the teal background layer by clicking the empty box to the left of it where the eye eye hide show icon should be.

    As we start fading our images, we want to ensure we can see the new background color right away.

  3. At the bottom of the Timeline panel, click the Duplicates selected frames button new button.

    We have our starting point, so now we’re going to create our end point. We’ll let Photoshop do the tweening for us in just a bit.

  4. Make sure frame 15 is selected.

  5. Select the Move tool move tool.
  6. In the Options bar at the top of the screen, uncheck Auto-Select.
  7. In the Layers panel, select the hit the text layer then Shift–click on the midday snooze button layer.
  8. Hold Shift and drag the two text layers down so that they are just out of view below the canvas.
  9. Make sure frame 15 and the two text layers are still selected.
  10. Towards the top right of the Layers panel, change Opacity to 0%.

  11. In the Layers panel, select the Z’s folder then Shift–click on the Sleeping Guy layer.

  12. Hold Shift and drag them up so that the z’s are just out of view above the canvas.

  13. Set the Opacity of all those layers to 0%.

  14. Select the Beach layer and set its Opacity to 0%.

    Only the teal background should be showing. This is what we’re transitioning to.

  15. In the Timeline panel, select frames 14 and 15.

  16. At the bottom of the Timeline panel, click the Tweens animation frames button tween button.

  17. In the Tween dialog:

    • Set Frames to Add to 5.
    • Under Layers choose All Layers.
    • Under Parameters leave all of them checked on (we need Position and Opacity because want to animate both the position and opacity at once).
    • Click OK.

    Let’s fix our timing. First we want the animation to pause a little before moving into the transition.

  18. Select frame 14, click 0.2 sec. and from the menu that appears, choose 0.5.

    The rest of the animation should be a little faster.

  19. Select frames 15 through 20, and set the frame delay time to 0.1 seconds.

  20. At the bottom of the Timeline panel, click the Play button play button to preview the animation. Notice how the text and the sleeping guy fade out as they move off-screen. Sweet! Click the Stop button stop button when you’re done.

Animating the Join Now Button

  1. It’s time to fade in some new text. Select frame 20 and click the Duplicates selected frames button new button.

  2. Select frame 21 and show the NAPS folder by clicking the empty box to the left of it.

  3. Select frames 20 and 21.

  4. At the bottom of the Timeline panel, click the Tweens animation frames button tween button.

  5. In the Tween dialog:
    • Set Frames to Add to 2.
    • Under Layers choose All Layers.
    • Under Parameters leave all of them checked on (we need Opacity because that’s what we’re animating).
    • Click OK.

    You’ll notice that even though we started with invisible layers and ended with visible layers, Photoshop uses opacity changes for the transition.

  6. Select frame 23 and click the Duplicates selected frames button new button.

  7. With frame 24 selected, show the join-now layer by clicking the empty box to the left of it.

    We want a slight pause before the Join Now button appears and a slightly longer pause before the Join Now button disappears so people have time to click on it.

  8. Select frame 23, click 0.1 sec. and from the menu that appears, choose 1.0.

  9. Select frame 24 and set the frame delay time to 5.0 seconds.

    Now we need to fade everything out again.

  10. With frame 24 selected, click the Duplicates selected frames button new button.

  11. Select frame 25.

  12. Hide the NAPS folder and the join-now layer by clicking the eye eye hide show icon to their left.

  13. Select frames 24 and 25.

  14. At the bottom of the Timeline panel, click the Tweens animation frames button tween button.

  15. In the Tween dialog:
    • Set Frames to Add to 2.
    • Under Layers choose All Layers.
    • Under Parameters leave all of them checked on (we need Opacity because that’s what we’re animating).
    • Click OK.
  16. Select frames 25 through 27 and set the frame delay time to 0.1 seconds.

  17. At the bottom of the Timeline panel, press the Play button play button to preview the animation. Press the Stop button stop button when you’re done.

  18. Press Cmd–S (Mac) or Ctrl–S (Windows) to save the working PSD.

Paying Attention to File Size

When saving for the web, file size is everything. The animation we just created will be a little large for our liking, so we’ll look at ways to make it as small as possible.

  1. Go to File > Export > Save for Web (Legacy).

  2. Click the 4-Up tab at the top.

    You’re now looking at the original, uncompressed image at the top of the window, and three different compressed versions below.

  3. Click on the second image to select this version.

  4. Using the buttons below Animation, step through our animation to the frame that uses the most colors: frame 14 (with the background beach photo). This is the best frame to see changes we make to the compression settings.

  5. From the Preset menu, choose GIF 128 Dithered and set the following:

    • Colors: 256
    • Dither: 100%

    In images with limited colors, adding dither gives the illusion that there are intermediate colors by scattering color pixels in the image. This creates the appearance of more colors and smoother transitions in an image, making it appear as if there is greater detail.

    There are three different options for Dither: Diffusion, Pattern, and Noise. Diffusion usually offers the smoothest transition. Keep in mind though, that adding dither also increases the file size.

  6. This is the best quality we can set on our animated GIF. However, notice that our file size is over 300K.

    There’s no standard rule for how small an animated GIF has to be. Each ad network has their own limits for how large a graphic you submit to them can be. In our case, we want to keep it under 100K. Let’s see if we can make this any smaller.

  7. Click on the third image to select this version.

  8. From the Preset menu, choose GIF 128 Dithered and set Dither to 100%.

    It looks like we were able to cut down the colors from 256 to 128 without losing too much quality. But the file size is over 250K, which is still too big. Let’s turn off Dither to further save on file size.

  9. From the menu that currently reads Diffusion, choose No Dither.

  10. Notice the file size dropped to around 200K but that’s still too big. Let’s see if we can reduce the colors any more.

  11. Click on the fourth image to select this version.

  12. From the Preset menu, choose GIF 64 No Dither.

  13. Change the Color reduction algorithm from Selective to Perceptual.

    The file size is down to around 160K. We can’t reduce the colors any more without noticeably losing quality. To get this file closer to 100K we’ll have to adjust the Lossy setting.

    Lossy will decrease the size of your file very quickly by discarding data from the file, but by doing so it will decrease the quality of your image. (You will start to see noticeable artifacts and distortions the higher the lossy setting.)

  14. Set Lossy to 30.

    Great! Lossy reduced our file size down to around 100K. Let’s step through the animation to see how our file is looking though.

  15. Using the buttons below Animation, step through our animation to frame 24.

  16. Notice that the color in our play button icon is really muted and gray compared to our original. Let’s fix that by adding this color back to our color table.

  17. At the top left of the window, choose the Eyedropper tool eyedropper tool.

  18. In the first image, click on the dark gray/red color in the circle around the play icon in the Join Now button.

  19. At the top left of the window, switch back to the Hand tool hand tool.

  20. Click on the fourth image to go back to that selection.

  21. Change the Color reduction algorithm from Perceptual to Custom.

    NOTE: By changing the option to Custom, we are able to keep the colors from using the Perceptual preference but can now add our own.

  22. Below the Color Table, click the Adds eyedropper color to palette button new button save for web.

  23. Notice that the color around our play icon looks more like the original, and our file size didn’t change much. Sweet!

    NOTE: If we hadn’t first changed the color reduction algorithm from Perceptual to Custom, instead of adding the eyedropper color to our palette, it would have replaced one of the existing colors. Be careful when doing this, as you may get unexpected shifts in colors in other parts of your image.

  24. Using the buttons below Animation, play through the animation. Notice that even though we made it to around 100K, we’re starting to lose some of the quality, especially in the beach photo and teal background. To get this at a more acceptable size, we’ll have to edit our animation.

Creating a Smaller Version

The lesson here is that you can’t do everything at once. The problem is that we wanted to use complicated images with complicated animations. You can usually have one or the other: complicated photos with very simple animation, or complicated animation with limited colors.

Pixels that stay the same color don’t add to the file size, but pixels that change color do. So the more pixels that change color, the larger the file. For example, when we faded from the beach photo to the teal background, we were changing ALL of the pixels, and that added to the size.

Large areas of the same color also take up much less space than a pattern or a texture or a complex photo. Let’s create another version taking out the beach photo altogether and see how it compares.

  1. Click Done to go back to the original file without saving the GIF.

  2. We’re going to replace the beach photo with a solid color. In the Layers panel, select the Beach layer.

  3. Select All by pressing Cmd–A (Mac) or Ctrl–A (Windows).

  4. Go to Edit > Fill and choose the following:
    • From the menu next to Contents choose Color.
    • Enter the color #E24637.
    • Click OK in the Color Picker, then click OK in the Fill menu.
  5. You can test the animation. We’ve just replaced the beach photo with the solid color red. Let’s save it again and see what happens.

  6. Go to File > Export > Save for Web (Legacy).

  7. Click on the second option.

  8. Using the buttons below Animation, step through our animation to frame 14.

  9. From the Preset menu, choose GIF 128 Dithered and change these settings:

    • Colors: 256
    • Dither: Diffusion 100%

    Even at full quality, our GIF is now below 100K! Let’s finesse it to get a file that’s even smaller.

  10. Click on the third option.

  11. From the Preset menu, choose GIF 128 No Dither and change these settings:

    • Colors: 64
    • Color Algorithm: Perceptual

    So far we’ve been using the preset numbers from the menu next to Colors. While these are great for quickly seeing how changes in the number of colors will change file size, you can use any number of colors up to 256. Let’s see if we can shave off some file size by reducing our colors by a few.

  12. Click into the Colors field so the cursor is blinking in there. (Do not click on the menu icon menu icon color!)

  13. Press the Down Arrow key on your keyboard a few times to shave off 1–2K from the file. If the loss of color becomes noticeable, press the Up Arrow to add back colors. (Make sure to step through the entire animation to make sure all frames look good.)

  14. Once you’re satisfied with the GIF size and quality, click Save.

  15. Name the file: yourname-NAPS.gif.

  16. Navigate into Desktop > Class Files > Animated GIFs Class > NAPS and click Save.

  17. Feel free to preview the GIF you just created by opening it in a browser.

Steps for Reducing File Size

As you saw in this exercise, sometimes it’s necessary to change aspects of an animation to meet a certain file size. Below are steps you can take to reduce the file size of your animations:

Flatten Graphics: Change to a more flat design that uses solid colors instead of gradations and photos.

Use Less Colors: Reduce the number of colors being used in your animation.

Reduce Pixel Changes: The more pixels you have changing from frame to frame, the larger your file size will be. Try to minimize the number of pixels that are changing between frames in the animation.

Reduce Frames: You can reduce file size by reducing the number of frames in your animation, but how much you save will depend more on how many pixels were changing from frame to frame.

photo of Dan Rodney

Dan Rodney

Dan Rodney has been a designer and web developer for over 20 years. He creates coursework for Noble Desktop and teaches classes. In his spare time Dan also writes scripts for InDesign (Make Book JacketProper Fraction Pro, and more). Dan teaches just about anything web, video, or print related: HTML, CSS, JavaScript, Figma, Adobe XD, After Effects, Premiere Pro, Photoshop, Illustrator, InDesign, and more.

More articles by Dan Rodney

How to Learn Photoshop

Master Photoshop, the industry-standard application for photo retouching, color correction, and more, with hands-on training.

Yelp Facebook LinkedIn YouTube Twitter Instagram