0

I have several png files named aoa19.5Pressure.XXX.png where XXXX is a four digit number. The names are such that the numbers are sequential. I want to convert these into a gif. When I run

convert aoa19.5Pressure.* aoa19.5Pressure.gif,

my machine takes a very long time to generate the gif. This has many more images than I needed. Is there some way I can convert these png files to a gif animation, only using every 100th png file to create the gif?

1

2 Answers 2

2

If the numbers are consecutive, just use

convert aoa19.5Pressure.*00.png aoa19.5Pressure.gif

This will use all images with numbers ending in 00, in other words every 100th.

1

A more generalized solution would be to include whatever wildcard you're filtering by in brackets.

Example 1: To take only even frames:

convert *[02468].png output.gif

Another way to do the same thing would be to delete all odd frames before converting (helpful if you don't want them cluttering your storage):

rm *[13579].png

and following up with:

convert *.png output.gif

Example 2: Of course, you can modify the original example if you want to sample more infrequently. You could use the below to filter by every multiple of 5:

convert *[05].png output.gif

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.