Skip to content

Tutorial Tools

Kevin Workman edited this page Jul 13, 2020 · 14 revisions

This page mostly contains notes on how I create the tutorial content.

Export as Gif

To export a Processing sketch as a gif, first add saveFrame() at the end of the draw() function. Make sure the frame rate is set to something a gif can handle, like 30.

Then open a command prompt at that directory, and type the following:

magick convert -delay 1x30 *.png animation.gif

(Depending on your setup you can drop the magick part.)

Delay First Frame

To create a delay at the first frame:

convert -delay 5x1 000.png -loop 1 -delay 1x2 *.png output.gif

See also: this answer by George Profenza on Stack Overflow.

Reduce Gif Size

magick convert -delay 1x30 *.png -coalesce -colors 16 -layers Optimize output.gif

Everything

magick convert -delay 1x1 001.png -delay 1x2 *.png -delay 1x1 999.png -coalesce -resize 600x325 -colors 16 -layers Optimize output.gif

Convert Image Frames to Movie (with mp3)

ffmpeg -r 30 -f image2 -s 1200x800 -i f-10-r/%04d.tga -i out/song.mp3 -vcodec libx264 -crf 25 -pix_fmt yuv420p output.mp4

More info here.

Clone this wiki locally