Comments (13)
I've generated gif from the asciicast linked by @ahmetb using latest (today's) version, with this command:
asciicast2gif -S 1 https://asciinema.org/a/dD9UhCIaPw13znirhmGUnNJtd.cast ahmetb.gif
Or Docker version:
docker run --rm -v $PWD:/data asciinema/asciicast2gif -S 1 https://asciinema.org/a/dD9UhCIaPw13znirhmGUnNJtd.cast ahmetb.gif
The resulting gif is 213kb, which is a good improvement over initial 964kb.
from asciicast2gif.
Heh, I don't use GNOME -- I actually ran it inside a Docker container, and had a small wrapper script to grab the proper X, Y, width, and height for capturing the window I was interested in. It doesn't need more than the X11 socket in order to work. 👍
from asciicast2gif.
I've played a little with ImageMagick and gifsicle
Command | Size (KB) | Savings (KB) |
---|---|---|
asciicast2gif 'https://asciinema.org/a/dD9UhCIaPw13znirhmGUnNJtd.cast?dl=true' out.gif |
941 | 0 |
asciicast2gif 'https://asciinema.org/a/dD9UhCIaPw13znirhmGUnNJtd.cast?dl=true' out.gif -S 1 * |
348 | 593 |
gifsicle --optimize -O3 --colors 16 -o out-16.gif out.gif |
336 | 593+12 |
convert out.gif -coalesce -layers RemoveDups -layers RemoveZero -layers OptimizeFrame out-dedupe.gif |
321 | 593+27 |
convert out.gif -coalesce -layers RemoveDups -layers RemoveZero -layers OptimizeFrame - | gifsicle --optimize -O3 -o out-dedupe-gifsicle.gif |
259 | 593+89 |
convert out.gif -coalesce -layers RemoveDups -layers RemoveZero -layers OptimizeFrame - | gifsicle --optimize -O3 --colors 16 -o out-dedupe-16.gif |
253 | 593+95 |
convert out.gif -coalesce -layers RemoveDups -layers RemoveZero -layers OptimizeFrame - | gifsicle --optimize -O3 --colors 6 --use-colormap=gray -o out-dedupe-bw.gif |
175 | 593+173 |
* The scaled=1 gif is used as an input for all remaining commands
from asciicast2gif.
There are many factors to the file size. The example.gif is only 497×290 pixels, uses few colours, is short (~28 seconds) and has a low area of change between frames (easier to compress).
asciicast2gif already uses gifsicle to compress the output gif, but there are more options from gifsicle that you can try.
BTW the -S
option in asciicast2gif is for up-scaling, you probably want to set it to 1.
from asciicast2gif.
You can also ask @tianon how the gif was generated.
from asciicast2gif.
Was a pretty standard byzanz (https://github.com/GNOME/byzanz) recording -- nothing very custom there.
from asciicast2gif.
Thanks for chiming in. Cool project for GNOME users.
from asciicast2gif.
@ahmetb can you give us a link to your recording which ends up being 964kb gif? We can play with various arguments for asciicast2gif and for gifsicle.
from asciicast2gif.
https://asciinema.org/a/dD9UhCIaPw13znirhmGUnNJtd
from asciicast2gif.
@publicarray awesome! That's very helpful.
Another things to try:
- check out giflossy instead of gifsicle (see #1)
- use gifsicle to assemble frames instead of ImageMagick (see #3)
I'm thinking that maybe asciicast2gif could have a concept of "presets", probably 3 (low, normal, high) would be enough to cover everyone's needs. But before presets, I'd like to try the above.
from asciicast2gif.
It'd be really cool to script these into a separate tool, or bundle in the asciicast2gif tool?
from asciicast2gif.
I've implemented some optimizations:
- the biggest impact on filesize was too high frame-rate - it's capped at 15fps now
- added support for giflossy (if giflossy is installed instead of gifsicle the options passed to gifsicle command are extended with
-lossy=80
)
I've pushed new version to npm, and there's new image on Docker hub (docker pull asciinema/asciicast2gif
if you previously pulled it).
You can set GIFSICLE_OPTS
env var to override the options passed to gifsicle, which is great for experimenting with different color/optimization/lossyiness combinations.
from asciicast2gif.
Thanks a bunch, that's a pretty good improvement!
from asciicast2gif.
Related Issues (20)
- Produced GIF freezes when played HOT 1
- Object has no method 'execSync' HOT 2
- [FR] Add option to specify working/tmp directory HOT 2
- Docker executable cannot read a file (ENOENT) HOT 4
- [FR] change temp dir (improve documentation) HOT 2
- Cache resources exhausted when converting to gif HOT 3
- Fails with ERR_STREAM_DESTROYED HOT 1
- Option to add a delay to the last frame HOT 1
- TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string HOT 6
- Certian grey text won't show HOT 1
- Fails with error write EPIPE on local file HOT 17
- [why?] HOT 7
- wsl install erro HOT 1
- Add margins to generated GIFs HOT 1
- [bug] Error: certificate has expired HOT 4
- FontFaceOnload error HOT 1
- <input-json-path-or-url> HOT 1
- cnpm install asciicast2gif error HOT 2
- cant display chinese HOT 1
- asciinema2gif: convert-im6.q16: cache resources exhausted HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asciicast2gif.