GNU bug report logs - #25583
26.0.50; :width/:max-width and vice versa in images

Previous Next

Package: emacs;

Reported by: Lars Ingebrigtsen <larsi <at> gnus.org>

Date: Mon, 30 Jan 2017 21:44:02 UTC

Severity: normal

Tags: fixed

Found in version 26.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 25583 <at> debbugs.gnu.org
Subject: bug#25583: 26.0.50; :width/:max-width and vice versa in images
Date: Tue, 31 Jan 2017 17:56:44 +0200
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Mon, 30 Jan 2017 22:42:44 +0100
> 
> As far as I can tell, it isn't documented what should happen if you have
> both :width and :max-height set in image specification, or vice versa.

I see this in the ELisp manual:

  ‘:width WIDTH, :height HEIGHT’
       The ‘:width’ and ‘:height’ keywords are used for scaling the image.
       If only one of them is specified, the other one will be calculated
       so as to preserve the aspect ratio.  If both are specified, aspect
       ratio may not be preserved.

  ‘:max-width MAX-WIDTH, :max-height MAX-HEIGHT’
       The ‘:max-width’ and ‘:max-height’ keywords are used for scaling if
       the size of the image of the image exceeds these values.  If
       ‘:width’ is set it will have precedence over ‘max-width’, and if
       ‘:height’ is set it will have precedence over ‘max-height’, but you
       can otherwise mix these keywords as you wish.  ‘:max-width’ and
       ‘:max-height’ will always preserve the aspect ratio.

So I think the behavior that should be expected is well documented.

> Here's the use case: I want to display images that are mostly square,
> but can sometimes be rectangular, and I want them to be displayed in max
> width if possible, even if they are smaller than that width originally,
> but not exceeding a certain height.
> 
> So I thought ":width 400 :max-height 500" should do the trick, but
> apparently compute_image_size just ignores :max-height in this case.
> 
> I think :max-height should "win" here... (That is, the width will end up
> smaller than 400 if making it 400 wide will make height exceed 500.)

Sorry, I don't understand how :max-height could (or should) affect the
width.  And where do you see in the code that :max-height is ignored
if :width is given?  My reading of the code is that that :max-height
is ignored only if :height is given.




This bug report was last modified 8 years and 9 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.