Subject: bug#48415: Subject: 27.2; Add filter-to-png support for user defined image formats

From: Dov Grobgeld <[email-masked]>
Date: Fri, 14 May 2021 12:07:07 +0300

--
This is a feature request and not a bug.

Background

Within org-mode I often reference external image resources of
hand drawn sketches that were drawn with the program krita. These
have the extension kra.  Internally this file format is a zip
file, with one of the entries being the image mergedimage.png . I
would like to display such kra images in emacs inline, just like
emacs can display any referenced png files.

Another similar format is the OpenRaster file format (which is
also a zip file with an embedded mergedimage.png), which by
default has the extension .ora.

Suggestion

I suggest that the inline image display in emacs will
be "extended" with a list of "filter functions" that map from a
user define file extension- to a function that extracts and
produces a png file. With such support it becomes trivial to
support inline display of kra and ora files by writing a function
that extracts the mergedimage.png from the zip file and supplies
it to emacs.

--

In GNU Emacs 27.2 (build 1, x86_64-redhat-linux-gnu, GTK+ Version
3.24.27, cairo version 1.17.4)
 of 2021-03-27 built on buildvm-x86-25.iad2.fedoraproject.org
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Fedora 34 (Workstation Edition)

Recent messages:

Configured using:
 'configure --build=x86_64-redhat-linux-gnu
 --host=x86_64-redhat-linux-gnu --program-prefix=
 --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr
 --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
 --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
 --libexecdir=/usr/libexec --localstatedir=/var
 --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png
 --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk3
 --with-gpm=no --with-xwidgets --with-modules --with-harfbuzz
 --with-cairo --with-json build_alias=x86_64-redhat-linux-gnu
 host_alias=x86_64-redhat-linux-gnu CC=gcc 'CFLAGS=-DMAIL_USE_LOCKF -O2
 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches
 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
 -Wp,-D_GLIBCXX_ASSERTIONS
 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong
 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
 -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
 LDFLAGS=-Wl,-z,relro
 PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS
LIBSYSTEMD JSON PDUMPER GMP

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  xmsi-mode: t
  show-paren-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-magit-file-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  shell-dirtrack-mode: t
  async-bytecomp-package-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:

Features:
(shadow sort mail-extr emacsbug org-clock org-agenda dabbrev mule-util
cal-move ox-beamer rfc2104 tramp-cache misearch multi-isearch winner
helm-command helm-elisp helm-eval edebug helm-info helm-mode helm-files
image-dired dired-x dired-aux ffap helm-buffers helm-tags helm-locate
helm-grep wgrep-helm helm-regexp helm-utils helm-types helm-help helm
helm-source eieio-compat helm-multi-match helm-lib wdired web-mode
mhtml-mode css-mode smie eww mm-url url-queue color js sgml-mode htmlize
.loaddefs el-get el-get-autoloading el-get-list-packages
el-get-dependencies el-get-build el-get-status el-get-methods
el-get-fossil el-get-svn el-get-pacman el-get-github-zip
el-get-github-tar el-get-http-zip el-get-http-tar el-get-hg el-get-go
el-get-git-svn el-get-fink el-get-emacswiki el-get-http el-get-notify
el-get-emacsmirror el-get-github el-get-git el-get-elpa el-get-darcs
el-get-cvs el-get-bzr el-get-brew el-get-builtin el-get-apt-get
el-get-recipes el-get-byte-compile el-get-custom el-get-core autoload
radix-tree lisp-mnt org-table xmsi-math-symbols-input face-remap org-man
screenshot ox-slidy ox-s5 org-bullets org-wikipedia org-jira-hyperlink
org-redmine-hyperlink org-comeet-hyperlink org-git-hyperlink org-eww
org-rmail org-mhe org-irc org-info org-gnus nnir org-docview doc-view
image-mode exif org-bibtex bibtex org-bbdb org-w3m paren cus-start
cus-load zoom-frm frame-cmds frame-fns avoid js-doc iswitchb google-look
qtdoc git-find-file ob-lua ob-C cc-mode cc-fonts cc-guess cc-menus
cc-styles cc-align ob-R ob-octave matlab gud ob-plantuml ob-asymptote
ob-dot ob-ditaa ob-python ob-perl ob-shell python-mode info-look
tramp-sh hippie-exp flymake-proc flymake ert ewoc debug backtrace
cc-cmds cc-engine cc-vars cc-defs persistent iimage org-crypt
load-theme-buffer-local ox-reveal ox-mediawiki ox-odt rng-loc rng-uri
rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns
nxml-enc xmltok nxml-util ox-latex ox-icalendar ox-html table ox-ascii
ox-publish ox s dmacro tramp tramp-loaddefs trampver tramp-integration
tramp-compat ls-lisp pdf-loader color-moccur dired-details+
dired-details sourcepair tempo xml-parse doxymacs ack epa-file files-x
jka-compr yasnippet visual-regexp-steroids visual-regexp pcre2el rxt
re-builder pydoc org-element avl-tree generator org ob ob-tangle ob-ref
ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint ob-keys
org-pcomplete org-list org-faces org-entities noutline outline
org-version ob-emacs-lisp ob-core ob-eval org-compat org-macs cal-menu
calendar cal-loaddefs gnus-sum shr svg dom gnus-group gnus-undo
gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo
parse-time iso8601 gnus-spec gnus-int gnus-range gnus-win gnus nnheader
goto-addr browse-kill-ring pretty-mode wgrep grep compile ein-loaddefs
org-loaddefs magit-bookmark bookmark pp magit-imenu git-rebase
magit-extras magit-ediff ediff ediff-merg ediff-mult ediff-wind
ediff-diff ediff-help ediff-init ediff-util magit-subtree
magit-submodule magit-obsolete magit-blame magit-stash magit-bisect
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-collab magit-files
magit-refs magit-status magit magit-repos magit-apply magit-wip
magit-log which-func imenu magit-diff smerge-mode diff magit-core
magit-autorevert autorevert filenotify magit-process magit-margin
magit-mode git-commit recentf tree-widget magit-git magit-section
magit-utils vc-git diff-mode ido crm log-edit message rfc822 mml mml-sec
epa epg epg-config gnus-util rmail rmail-loaddefs text-property-search
time-date mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader
pcvs-util add-log ghub url-http mail-parse rfc2231 url-gw nsm rmc puny
url-auth url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util mailcap magit-popup format-spec
with-editor cl-extra warnings term disp-table ehelp eshell esh-cmd
esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util
dired dired-loaddefs shell pcomplete comint server sticky-w
init-flycheck flycheck ansi-color find-func help-mode rx init-ssh-agency
ssh-agency init-telega telega telega-info telega-chat telega-msg
telega-root derived telega-filter wid-edit telega-server
telega-customize telega-core ring init-helm helm-config helm-easymenu
async-bytecomp async pcase init-multiple-cursors multiple-cursors
mc-hide-unmatched-lines-mode mc-separate-operations
rectangular-region-mode mc-mark-pop mc-mark-more thingatpt
mc-cycle-cursors mc-edit-lines multiple-cursors-core easy-mmode edmacro
kmacro advice rect finder-inf info smtpmail sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils dash cl clang-rename
clang-include-fixer let-alist clang-format xml package easymenu
browse-url url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win
x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting xwidget-internal cairo move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 1625465 106870)
 (symbols 48 64815 5)
 (strings 32 244674 9774)
 (string-bytes 1 8227842)
 (vectors 16 70177)
 (vector-slots 8 1728176 257632)
 (floats 8 536 239)
 (intervals 56 31987 664)
 (buffers 1000 36))