Text to image

a simple text to image function for Emacs using Image Magick
(defun txt2img ()
  (interactive)
  (let ((b (min (point) (or (mark) (point-min))))
        (e (max (point) (or (mark) (point-max)))))
    (shell-command
     (concat "convert -background whitesmoke -fill black -font Georgia -pointsize 16 -size 340x caption:"
             "\'" (buffer-substring-no-properties  b e) "' ~/Desktop/twitter/caption.png")))
  (shell-command "convert ~/Desktop/twitter/caption.png -matte -bordercolor whitesmoke -border 10x10 ~/Desktop/twitter/caption_b.png")
    (shell-command "mv ~/Desktop/twitter/caption_b.png ~/Desktop/twitter/caption.png"))

Happy hacking!

Palavras chave/keywords: emacs, lisp

Criado/Created: 08-10-2015 [14:14]

Última actualização/Last updated: 13-07-2018 [09:50]


Voltar à página inicial.


GNU/Emacs Creative Commons License

(c) Tiago Charters de Azevedo