Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Commands for viewing images

27 views
Skip to first unread message

Sébastien Vauban

unread,
Feb 25, 2009, 7:48:46 AM2/25/09
to
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?

Best regards,
Seb

--
Sébastien Vauban

Tassilo Horn

unread,
Feb 25, 2009, 10:29:32 AM2/25/09
to help-gn...@gnu.org
Sébastien Vauban <zthjws...@spammotel.com>
writes:

Hi Sébastien,

> 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.

What we call zoom in doc-view is indeed a reconversion with different
resolution. We did that cause emacs lacks zooming support. ;-)

Else we'd just convert with a huge resolution and zoom out a bit, which
would be much faster. Well, somebody gotta implement it...

Bye,
Tassilo
--
The air around Chuck Norris is always a balmy 78 degrees.

Xah Lee

unread,
Feb 25, 2009, 2:04:05 PM2/25/09
to
On Feb 25, 4:48 am, Sébastien Vauban <zthjwsqqa...@spammotel.com>
wrote:

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/


0 new messages