Function: image-cut

image-cut is an autoloaded, interactive and byte-compiled function defined in image-crop.el.gz.

Signature

(image-cut &optional COLOR)

Documentation

Cut a rectangle from the image under point, filling it with COLOR.

COLOR defaults to the value of image-cut-color. Interactively, with prefix argument, prompt for COLOR to use.

This command presents the image with a rectangular area superimposed on it, and allows moving and resizing the area to define which part of it to cut.

While moving/resizing the cutting area, the following key bindings are available:

q: Exit without changing anything.
RET: Crop/cut the image.
m: Make mouse movements move the rectangle instead of altering the
       rectangle shape.
s: Same as m, but make the rectangle into a square first.

After cutting the image, you can save it by M-x image-save or i o (image-save) when point is over the image.

View in manual

Probably introduced at or before Emacs version 29.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/image/image-crop.el.gz
;;;###autoload
(defun image-cut (&optional color)
  "Cut a rectangle from the image under point, filling it with COLOR.
COLOR defaults to the value of `image-cut-color'.
Interactively, with prefix argument, prompt for COLOR to use.

This command presents the image with a rectangular area superimposed
on it, and allows moving and resizing the area to define which
part of it to cut.

While moving/resizing the cutting area, the following key bindings
are available:

`q':   Exit without changing anything.
`RET': Crop/cut the image.
`m':   Make mouse movements move the rectangle instead of altering the
       rectangle shape.
`s':   Same as `m', but make the rectangle into a square first.

After cutting the image, you can save it by `M-x image-save' or
\\<image-map>\\[image-save] when point is over the image."
  (interactive (list (and current-prefix-arg
                          (read-color "Color to use for filling: "))))
  (image-crop (if (zerop (length color)) image-cut-color color)))