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: 83
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: 2839
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: 83
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: 11114
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: 1714
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: 263
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: 83
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: 2839
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
Airwolf/F4CG
Guests online: 130
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Bromance  (9.6)
10 Memento Mori  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 S!R  (9.9)
3 Antitrack  (9.8)
4 Mr Zero Page  (9.8)
5 OTD  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.047 sec.