• Stars
    star
    110
  • Rank 316,770 (Top 7 %)
  • Language
    Emacs Lisp
  • License
    GNU General Publi...
  • Created over 6 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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.

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

(require 'blimp)
(add-hook 'image-mode-hook 'blimp-mode)

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

;; 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)

Or if you want to run commands with all their paramaters already set

;; 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)

To resize images using the mouse you can do

(define-key blimp-mode-map (kbd "<down-mouse-3>") 'eimp-mouse-resize-image-preserve-aspect)
(define-key blimp-mode-map (kbd "<down-mouse-2>") 'eimp-mouse-resize-image)

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.