Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > CSDb Discussions > Bash script to generate screenshot animations
2022-03-31 20:56
Cupid

Registered: Jan 2002
Posts: 84
Bash script to generate screenshot animations

Hey, as I am posting a lot of fonts right now I thought I wanted to automate creating the animated screenshot and resize the 320x200 PNG files to the necessary 384x272 at the same time.

You can use the following bash script with FFMPEG (https://ffmpeg.org/):

fromwidth=320
towidth=384
fromheight=200
toheight=272
borderadd=-border
animationname=-animation.gif
framerate=1.2
ypad=$((toheight-fromheight))
xpad=$((towidth-fromwidth))
padstring=[0]pad=w=$xpad+iw:h=$ypad+ih:x=$((xpad/2)):y=$((ypad/2)):color=black
ffmpeg -i $1%d.png -pix_fmt rgb24 -filter_complex "$padstring" $1$borderadd%d.png
ffmpeg -f image2 -framerate 1.2 -i $1$borderadd%d.png -loop 1 $1$animationname

I saved this as "build.sh" and using

$bash build.sh fatumfont

takes fatumfont1.png and fatumfont2.png, resizes each and saves them as fatumfont1-border.png and fatumfont2-border.png and creates an animated GIF of both of them with ~600ms in between the frames saved as fatumfont-animation.gif
2022-03-31 21:15
Krill

Registered: Apr 2002
Posts: 3079
My go-to solution is ImageMagick.
$ cat makegif.sh 
convert ./ambercow.png  -resize 100%x106.78% -gravity center -extent 384x290 ambercow_pal.png
convert ./lovecats.png  -resize 100%x133.33% -gravity center -extent 384x290 lovecats_ntsc.png
convert ./mule.png      -resize 100%x110.17% -gravity center -extent 384x290 mule_paln.png
convert ./starquake.png -resize 100%x106.78% -gravity center -extent 384x290 starquake_pal.png
convert ./challenge.png -resize 100%x133.33% -gravity center -extent 384x290 challenge_ntsc.png
convert -delay 200 -loop 0 ambercow_pal.png lovecats_ntsc.png mule_paln.png starquake_pal.png challenge_ntsc.png Transwarp.gif
2022-03-31 21:20
Cupid

Registered: Jan 2002
Posts: 84
Also cool.

I just added creating the d64 of all prg files in the folder, too:

fromwidth=320
towidth=384
fromheight=200
toheight=272
borderadd=-border
animationname=-animation.gif
framerate=1.2
ypad=$((toheight-fromheight))
xpad=$((towidth-fromwidth))
padstring=[0]pad=w=$xpad+iw:h=$ypad+ih:x=$((xpad/2)):y=$((ypad/2)):color=black
ffmpeg -i $1%d.png -pix_fmt rgb24 -filter_complex "$padstring" $1$borderadd%d.png
ffmpeg -f image2 -framerate 1.2 -i $1$borderadd%d.png -loop 1 $1$animationname
cc1541_mac -n $1 $1.d64
for file in *.prg; do
cc1541_mac -f ${file/\.prg/} -w ${file##*/} $1.d64
done
2022-03-31 21:22
chatGPZ

Registered: Dec 2001
Posts: 11506
now fiddle with vice options and you dont even have to make the screenshots... sth like

x64sc -default -console -exitscreenshot foo.png -limitcycles 10000000 bla.prg
2022-03-31 21:41
tlr

Registered: Sep 2003
Posts: 1807
Quote: My go-to solution is ImageMagick.
$ cat makegif.sh 
convert ./ambercow.png  -resize 100%x106.78% -gravity center -extent 384x290 ambercow_pal.png
convert ./lovecats.png  -resize 100%x133.33% -gravity center -extent 384x290 lovecats_ntsc.png
convert ./mule.png      -resize 100%x110.17% -gravity center -extent 384x290 mule_paln.png
convert ./starquake.png -resize 100%x106.78% -gravity center -extent 384x290 starquake_pal.png
convert ./challenge.png -resize 100%x133.33% -gravity center -extent 384x290 challenge_ntsc.png
convert -delay 200 -loop 0 ambercow_pal.png lovecats_ntsc.png mule_paln.png starquake_pal.png challenge_ntsc.png Transwarp.gif


+1

ImageMagick is great for this!
2022-04-01 09:25
bepp

Registered: Jun 2010
Posts: 268
If you're into drag n drop, you can use this tool. https://csdb.dk/release/?id=125943. Very simple to use!
2022-04-05 09:59
Cupid

Registered: Jan 2002
Posts: 84
I am into drag and drop, but not into installing, so I created a web version:

https://codepo8.github.io/CSDB-screen-generator/
2022-04-05 10:22
Krill

Registered: Apr 2002
Posts: 3079
Yeah, why run stuff on your own machine when you can on somebody else's? :)
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
AMB/Level 64
Guests online: 179
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.6)
4 Codeboys & Endians  (9.6)
5 Edge of Disgrace  (9.6)
6 Coma Light 13  (9.6)
7 Signal Carnival  (9.6)
8 What Is The Matrix 2  (9.6)
9 Uncensored  (9.6)
10 Comaland 100%  (9.6)
Top onefile Demos
1 Nine  (9.7)
2 Scan and Spin  (9.7)
3 Layers  (9.6)
4 Two 4 One  (9.6)
5 Cubic Dream  (9.6)
6 Party Elk 2  (9.6)
7 Copper Booze  (9.5)
8 Onscreen 5k  (9.5)
9 Libertongo  (9.5)
10 Dawnfall V1.1  (9.5)
Top Groups
1 Artline Designs  (9.4)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Performers  (9.3)
5 Censor Design  (9.3)
Top Graphicians
1 Mirage  (9.7)
2 Archmage  (9.7)
3 Sulevi  (9.6)
4 Pal  (9.6)
5 Hein  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2025
Page generated in: 0.076 sec.