Just use ffmpeg
This commit is contained in:
23
graphgif.scm
23
graphgif.scm
@@ -1,7 +1,6 @@
|
||||
(define-module (graphgif))
|
||||
|
||||
(use-modules (cairo)
|
||||
(cgif)
|
||||
(srfi srfi-1))
|
||||
|
||||
(re-export (cairo-pattern-create-rgb . create-color))
|
||||
@@ -59,11 +58,6 @@
|
||||
(cairo-destroy cr)
|
||||
surface))
|
||||
|
||||
(define-public (write-graphs-to-file graphs filename)
|
||||
(let ([surfaces (map draw-abstract-graph graphs)])
|
||||
(make-gif surfaces filename)
|
||||
(for-each (lambda (s) (cairo-surface-destroy s)) surfaces)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Graph Generation ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -107,6 +101,23 @@
|
||||
(reverse lst)
|
||||
(loop (1+ i) (cons (make-node i) lst)))))
|
||||
|
||||
;;;;;;;;;;;;
|
||||
;; Output ;;
|
||||
;;;;;;;;;;;;
|
||||
|
||||
(define (output-to-file surfaces filename)
|
||||
(define pngdir (mkdtemp "graphgif_XXXXXX"))
|
||||
(do ([i 1 (1+ i)]
|
||||
[surfaces surfaces (cdr surfaces)])
|
||||
((null? surfaces))
|
||||
(cairo-surface-write-to-png
|
||||
(car surfaces)
|
||||
(string-append pngdir "/img-" (number->string i) ".png")))
|
||||
(system* "ffmpeg" "-i" (string-append pngdir "/img-%d.png") "-r" "1" filename))
|
||||
|
||||
(define-public (write-graphs-to-file graphs filename)
|
||||
(output-to-file (map draw-abstract-graph graphs) filename))
|
||||
|
||||
;; Local Variables:
|
||||
;; geiser-scheme-implementation: guile
|
||||
;; End:
|
||||
|
||||
Reference in New Issue
Block a user