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

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

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


From: Eli Zaretskii
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 <address@hidden>
> 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.





reply via email to

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