help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Commands for viewing images


From: Xah Lee
Subject: Re: Commands for viewing images
Date: Wed, 25 Feb 2009 11:04:05 -0800 (PST)
User-agent: G2/1.0

On Feb 25, 4:48 am, Sébastien Vauban <zthjwsqqa...@spammotel.com>
wrote:
> Hello,
>
> I view more and more image files from within Emacs, be it from a
> Dired buffer, or as an attachment in a mail that I view in Gnus.
>
> My problem is: how can we zoom (out, mainly) the picture?
>
> It doesn't seem to be any way to do so in the `image-mode'.
> Though, it should be possible as similar functions already have
> been implemented for the `doc-view' package. Is there a package
> I should know of, that would take care of adding zooming
> commands when viewing buffers with pictures?

i have no idea how zoom can be implemented as shown in typical image
viewers. I suppose it's recompute the bitmap and redisplay.

Note that in many browsers, Opera for example, you can zoom the whole
page. (i.e. not the same as changing font size) This feature is in
Mathematica IDE too (aka Frontend), since early 1990s.

i doubt this feature could easily fit into emacs, probably require
huge coding effort to its core.

as a workaround, you could have elisp wrapper that call image magic to
create a resized file as temp and display that.

e.g.
convert -scale 50% girl.jpg girl-s.jpg

you could also call “identify” to get the image dimension first, then
some function in emacs to get the emacs window size, so that you can
use the proper scale factor to make the image fit to window.

here's a elisp that gets img dimension in pure elisp

(defun get-image-dimensions (img-file-relative-path)
  "Returns a image file's width and height as a list."
  (let (tmp dimen)
    (clear-image-cache)
    (setq tmp
          (create-image (concat default-directory img-file-relative-
path)))
    (setq dimen (image-size tmp t))
    (list (car dimen) (cdr dimen))
  )
)

probably best just to view it in a dedicated image viewer. You can
easily write a elisp so that pressing a button shows the image in a
external app. (i suppose this is already in image-mode?)

  Xah
∑ http://xahlee.org/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]