4 – An update on outputting results in Ansys Mechanical: Animated GIFs

Categories:

This post is the fourth of six, and it is about making animation files that are not videos, called Animated GIFs (pronounced with a J like Jeff, not G like Garry).
For a couple of reasons, making an animated gif is not as easy as we would like, but with a few tips below, it is not so difficult.

Animated GIFs explained

The GIF image file, Graphics Interchange Format, was invented in 1987 when color computing was new and the internet was not around yet. It is compact and allows only 256 colors (remember that part) and supported animation. The animated format was very popular on dial-up services and the early internet. They then fell out of favor until their use in messaging apps and social media to send animations to people that did not require a player. Everyone could see your cat falling off the table, instantly.

Or their dog being woken up in the middle of an afternoon nap. I just took my iPhone, turned around in my chair, and took this video. Then I converted it to a GIF. It took me less than 30 seconds to make and share this gem:

Maggie Wake Up

For those of us in the world of simulation, they have been a popular format for the same reason—almost all applications, from email to web browsers to Microsoft Powerpoint, support animated GIFs. The file contains as many images as you want and a tag for each layer documenting how long to display each frame. The difference is we are not capturing our overweight mutt struggling to roll over. We have specific information we are trying to convey.

Ansys Mechanical Default

If you read the post about making videos, you will remember that one of the output options was GIF. Well, here is what you get when you use that option. Note, it only plays once, to play it again.

i1 m15 1

And by default, the file does not repeat. Also, to make things worse, the way Ansys stores the GIF is an order of magnitude larger than a video.

As a contrast, here is the same result as a video played through YouTube:

Impeller vibration using a video file rather than GIF. As shown with YouTube

Video to GIF is much better

So, unless you need something in 30 seconds, don’t use the default save video as GIF in Ansys Mechanical. A much better option is to convert a good video to a GIF.

So, go back to the article on making videos and get what you want for your animation using that info and save it to *.mp4 format. Then use one of the methods below to convert that to GIF.

Ezgif.com

If I take the video above that I posted on YouTube and run it through the free conversion tool, ezgif.com, I get this:

i1 m15 1 ezgif

It is not as nice as the video, but it does not need a player. It just plays. Ezgif.com is free (lots of advertising) but has a lot of options. Not only does it covert quickly, but it also lets you crop, resize, add effects, change the speed, add text, and overlay.

The downside, if you have proprietary information you are letting someone else see it. My guess is uploading to a free server in the cloud will violate any NDA or security you have in place. But if not, ezgif.com is the simplest way to get a GIF from a video.

Adobe PhotoShop

The first option, if you can’t use a free cloud-based tool like ezgif.com, is the Photoshop suite. Photoshop is the defacto tool for image editing and processing, and it has a lot of tools for making sophisticated animated GIFs, including importing a video, editing the frames from the video, and outputting a GIF.

Here is the process:

  1. Open Adobe Photoshop
  2. Chose File > Import > Vidio to Layers
  3. Chose your MP4 file
  4. In the “Import Video to Layers” dialog, make sure “From Beginning to End” is chosen and “Make Frame Animation” is checked on.
  5. Click OK
    1. At this point, you can do a huge amount of modifying and editing. But that is way beyond the scope of this post. We just want a GIF made. But if you know Adobe Photoshop, have at it. I often crop and change the size here. Maybe even run some filters on it. Or, if I’m getting really fancy, delete the background from each frame to have a transparent animation.
  6. Go to File > Export > Save for Web (Legacy)
  7. Chose GIF as the file format.
    1. Set colors to 256
    2. I like to set Dither to 100%
    3. Make sure Animation > Looping Options at the bottom is set to Forever.
    4. Click Save… and give it a file name.
image 87

Here is what the result looks like:

i1 m15 1 PS1 1

Adobe Premier

Adobe Premiere is, well, the premier tool for video editing and creation. Many professional videos are made with this tool. It is massive, powerful, and made for people who speak video. If you want to add to your animation, do fancy things with it, use Premiere. Otherwise, stick with Photoshop or an open-source or cloud tool.

But, if you want to use Premier, here is that basic process without any bells or whistles (literally and figuratively) added in:

  1. Open a new Project
  2. Specify a good directory for the project
  3. Drop your MP4into the Project Window
  4. The drag it to the Timeline
    1. Here is where you do your editing magic on the video.
  5. When you are ready to make your file, click File > Export > Media
  6. Chose Animated GIF for the format
    1. Do not pick GIF. That will make an image of every frame.
  7. Click on the name next to “Output Name” to set the name and directory.
  8. Make any other changes you feel are correct if you know Premier.
  9. Click Export
image 88

This is what you get.

i1 m15 1 Premier 1 1

GifTuna

if you don’t have access to any Adobe tools, I recommend GifTuna. Yes, the name is stupid. But it works and it is free.

Go to giftuna.io and download the app. it comes as a ZIP file. Just extract the zip file and run the executable, GifTuna.exe. It will then ask you to install FFMPEG. This is the same library that ezgif.com uses.

Once everything is installed:

  1. Click “Select File”
  2. Select the video you saved in Ansys Mechanical.
  3. Change the size if you want to
  4. Keep all the other defaults for your first pass.
  5. Click Export
image 85
image 86

You get a pretty nice video. Play with the dither options if it looks kind of fuzzy.

i1 m15 1 giftuna

Making an Animated GIF out of Images

In all the examples above, we created animations by converting a good video into an animated GIF format. What if we just have a bunch of images and want to make a slide show out of them. Or maybe we want to show a series of geometry changes. Maybe the various steps in an animation.

In that case, save an image to a PNG or JPEG file for each frame you want, then use ezgif.com or PhotoShop to make your animation.

A word about APNG

The only real problem with Animated GIFS is that the GIF format only supports 256 colors. In many ways, PNG took over for GIF as the preferred file format. It is compact, handles transparency, and has the advantage of not being restricted on colors. The problem, only browsers support APNG. PowerPoint and most mail programs do not. And many tools like the Adobe Suite do not output in that format. But, ezgif.com does.

In fact, WordPress does not support the format. To view the APNG file, download this file and then open it in a browser:

Maybe someday this will be supported better. Hopefully in Microsoft products soon.

Moving from Motion to 3D

This should help you get a nice animation that you can put on a website and not have to worry about hosting so people can see it. The same goes for Email and PowerPoint. If you can live with fewer colors, it really is the best format for animations of results when you need to show them anywhere.

Now it’s time to move from 2D results to 3D. We will cover how to create 3D objects of your results in “5 – An update on outputting results in Ansys Mechanical: 3D Result Objects.

Categories

Get Your Ansys Products & Support from the Engineers who Contribute to this Blog.

Technical Expertise to Enable your Additive Manufacturing Success.

PADT’s Pulse Newsletter

Keep up to date on what is going on at PADT by subscribing to our newsletter.


By submitting this form, you are consenting to receive marketing emails from: . You can revoke your consent to receive emails at any time by using the SafeUnsubscribe® link, found at the bottom of every email. Emails are serviced by Constant Contact

Share this post:

Upcoming Events

03/27/2024

2024 Arizona Space Summit

03/28/2024

SAF Blue Carpet Event

03/28/2024

2024 Arizona Space Summit

04/03/2024

Low Frequency Updates in Ansys 2024 R1 - Webinar

04/03/2024

Venture Madness Conference Reception + Expo

04/03/2024

Stratasys F3300: Game Changing Throughput - Webinar

04/08/2024

39th Space Symposium

04/09/2024

39th Space Symposium

04/10/2024

Discovery Updates in Ansys 2024 R1 - Webinar

04/10/2024

39th Space Symposium

04/11/2024

39th Space Symposium

04/22/2024

Experience Stratasys Truck Tour: Houston, TX

04/24/2024

Structures Updates in Ansys 2024 R1 (2)

04/24/2024

Experience Stratasys Truck Tour: Houston, TX

05/07/2024

Experience Stratasys Truck Tour: Albuquerque, NM

05/08/2024

Fluent Materials Processing Updates in Ansys 2024 R1 - Webinar

05/09/2024

Experience Stratasys Truck Tour: Los Alamos, NM

05/14/2024

Simulation World 2024

05/15/2024

Simulation World 2024

05/16/2024

Simulation World 2024

05/22/2024

Optics Updates in Ansys 2024 R1 - Webinar

06/12/2024

Connect Updates in Ansys 2024 R1 - Webinar

06/26/2024

Structures Updates in Ansys 2024 R1 (3) - Webinar

06/27/2024

E-Mobility and Clean Energy Summit

07/10/2024

Fluids Updates in Ansys 2024 R1 - Webinar

08/05/2024

2024 CEO Leadership Retreat

10/23/2024

PADT30 | Nerdtoberfest 2024

Search in PADT site

Contact Us

Most of our customers receive their support over the phone or via email. Customers who are close by can also set up a face-to-face appointment with one of our engineers.

For most locations, simply contact us: