✍ 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: 23-01-2017 [09:20]


GNU/Emacs

1999-2017 (ç) Tiago Charters de Azevedo

São permitidas cópias textuais parciais/integrais em qualquer meio com/sem alterações desde que se mantenha este aviso.

Verbatim copying and redistribution of this entire page are permitted provided this notice is preserved.