This function gives the native pixel dimensions of an image: (defun es-image-file-pixel-dimensions (file) (let* ((type (image-type file nil nil)) (spec (list 'image :type type :file file))) (image-size spec t))) When (> (getf (cdr (doc-view-current-image)) :width) (car (es-image-file-pixel-dimensions (getf (cdr (doc-view-current-image)) :file)))) there is quality loss. What I don't want to see is margins having a different width - for the same reasons you wouldn't put a photograph in a frame in the top left corner. Ideally I'd also center vertically (should the image be shorter than the window) and add a window-configuration-change-hook (or there might be an appropriate display-spec), so it's always centered. Unfortunately no image-viewer that currently comes with emacs (image-mode ,doc-view-mode ,image-dired-display-image-mode) does this. Evgeni On Wed, Mar 6, 2013 at 1:01 PM, Tassilo Horn wrote: > E Sabof writes: > > > I've tried it, indeed it works much better. Might it be possible to > > store the the "native" size, and raise the resolution automatically > > when the zoom exceeds it? > > Well, the resolution should be increased and the doc reconverted when > the up-scaled image becomes blurry. But how should emacs know when you > think it becomes blurry? > > > On a side note, might it be also possible to horizontally center the > > image? There is a pretty straight-forward way to do it, used in the > > about-emacs screen. > > I guess this could be done somehow. But do you want to center to make > the contents a bit larger and not to see the margins? If so, then > slicing to the bounding box (`s b') followed by fitting to width (`W') > may be the better approach. > > Bye, > Tassilo >