GNU Emacs as a Comic Book Reader



 

Comics are available in digital format as a collection of images in a compressed ZIP or RAR file (.cbz or .cbr file extension respectively). These can be enjoyed in GNU Emacs with full access to image viewing capabilities using keybindings.

 
# Make sure you have unrar installed for CBR files
# apt install unrar
 
(require 'arc2-mode)
 
(setq archive-summarize-files-fn 'archive-summarize-files-as-thumb)
 

 

Note: The archive-mode is capable of displaying the list of files in an archive; though it depends on external tools for extraction.

For JPG and PNG, Emacs can resize the image without external convertor (ie. imagemagick). However, some menu options for image transformations in image-mode might not be available. Use the following patch for image-mode.el.

@@ -460,16 +460,16 @@ image-mode-map
      :help "Show image as hex"]
     "--"
     ["Fit to Window Height" image-transform-fit-to-height
-     :visible (eq image-type 'imagemagick)
+     ;; :visible (eq image-type 'imagemagick)
      :help "Resize image to match the window height"]
     ["Fit to Window Width" image-transform-fit-to-width
-     :visible (eq image-type 'imagemagick)
+     ;; :visible (eq image-type 'imagemagick)
      :help "Resize image to match the window width"]
     ["Rotate Image..." image-transform-set-rotation
-     :visible (eq image-type 'imagemagick)
+     ;; :visible (eq image-type 'imagemagick)
      :help "Rotate the image"]
     ["Reset Transformations" image-transform-reset
-     :visible (eq image-type 'imagemagick)
+     ;; :visible (eq image-type 'imagemagick)
      :help "Reset all image transformations"]
     "--"
     ["Show Thumbnails"
 

 

Image Magnifier

If you want to focus on what's important while keeping the full picture in view, you can use image magnifier tool.



 
(require 'comics-mode)
 
(comics-zoom)
 
;; Toggle image magnifier
M-x comics-zoom 
 
 

Archive Mode: Custom views

List view

Table view

  • List view - An example of a simplest custom function
  • Table view
  • Thumbail view - Displays image files in an archive
;; List view
(setq archive-summarize-files-fn 'archive-summarize-files-as-list)
 
;; Table view
(setq archive-summarize-files-fn 'archive-summarize-files-in-table)

;; Thumbail view
(setq archive-summarize-files-fn 'archive-summarize-files-as-thumb)
 
 

 

Code

 

Comments

Popular posts from this blog

HTML Renderer (Emacs)

Mozilla Readability in GNU Emacs