blimp icon indicating copy to clipboard operation
blimp copied to clipboard

A complete wrapper around all imagemagick commands with autocompletion, descriptions and hints displayed in prompt

[[https://melpa.org/#/blimp][file:https://melpa.org/packages/blimp-badge.svg]]

  • Blimp - Bustling Image Manipulation Package Blimp is a complete wrapper around all imagemagick commands with descriptions, autocompletion (for some commands) and hints displayed in prompt using eimp.el to execute its commands and resize images.

#+html: Blimp command building

** Features

  • Should support all documented imagemagick commands (as of Aug 2018)
  • Supports all completion frontends (ivy, helm, ido, etc)
  • Writes changes to buffer instead of file allowing you to revert changes before saving
  • Undo and redo image changes with =(setq eimp-enable-undo t)=
  • Parameter autocomplete for some commands
  • Description of command and input format in prompt
  • Resize images to fit window or manually using the mouse

** Install #+BEGIN_SRC emacs-lisp (require 'blimp) (add-hook 'image-mode-hook 'blimp-mode) #+END_SRC

** Usage First enter an image-buffer and type =C-c C-o= to bring up the =blimp-interface=. After choosing a imagemagick command and its parameters, type =C-c C-e= to apply the chosen command(s) on the current image or =C-c C-r= to clear all queued commands. You can also do =C-c C-O= to apply the command right after selecting it and =C-c C-p= to toggle the current command prefix between "+" and "-".

If you want to resize the current image to fit the buffer you have several alternatives: =M-x eimp-fit-image-height-to-window= or =M-x eimp-fit-image-to-whole-window= or =M-x eimp-fit-image-to-window= or =M-x eimp-fit-image-width-to-window=

** Configuration If you want to skip using =blimp-interface= and instead have hotkeys for specific commands you can do #+BEGIN_SRC emacs-lisp ;; Prompts for amount of degrees to rotate then applies the rotation (defun my/blimp-rotate() (interactive) (blimp-interface-execute "rotate"))

(define-key eimp-mode (kbd "C-c C-R") 'my/blimp-rotate) #+END_SRC

Or if you want to run commands with all their paramaters already set #+BEGIN_SRC emacs-lisp ;; Rotates image 90 degrees when called (defun my/blimp-rotate-90() (interactive) (blimp-add-to-command-stack (list "-rotate" "90")) (blimp-execute-command-stack))

(define-key eimp-mode (kbd "C-c C-R") 'my/blimp-rotate-90) #+END_SRC

To resize images using the mouse you can do #+BEGIN_SRC emacs-lisp (define-key blimp-mode-map (kbd "") 'eimp-mouse-resize-image-preserve-aspect) (define-key blimp-mode-map (kbd "") 'eimp-mouse-resize-image) #+END_SRC

*** Macros When using the above commands in macros to quickly modify a lot of images, keep in mind that eimp.el (and by extension =blimp-execute-command-stack=) is async, so you need to wait for the command stack to execute before switching image. To do this i just add =(sleep-for 0.2)= at the end of the script, e.g. at the end of =my/blimp-rotate-90=. More complex commands might require more time to execute so keep this in mind.