Function: image-converter-add-handler
image-converter-add-handler is an autoloaded and byte-compiled
function defined in image-converter.el.gz.
Signature
(image-converter-add-handler SUFFIX CONVERTER)
Documentation
Make Emacs use CONVERTER to parse image files whose names end with SUFFIX.
CONVERTER is a function with two arguments, the file name or a string
with the image data, and a non-nil value if the first argument is image data.
The converter should produce the image in the current buffer, converted to
the format given by image-convert-to-format.
SUFFIX should not include the leading dot.
Probably introduced at or before Emacs version 29.1.
Source Code
;; Defined in /usr/src/emacs/lisp/image/image-converter.el.gz
;;;###autoload
(defun image-converter-add-handler (suffix converter)
"Make Emacs use CONVERTER to parse image files whose names end with SUFFIX.
CONVERTER is a function with two arguments, the file name or a string
with the image data, and a non-nil value if the first argument is image data.
The converter should produce the image in the current buffer, converted to
the format given by `image-convert-to-format'.
SUFFIX should not include the leading dot."
(cl-pushnew suffix image-converter-file-name-extensions :test #'equal)
(setq image-converter-file-name-extensions
(sort image-converter-file-name-extensions #'string<))
(setq image-converter-regexp
(concat "\\." (regexp-opt image-converter-file-name-extensions) "\\'"))
(setf (gethash suffix image-converter--extra-converters) converter))