From: Eli Zaretskii <eliz@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 25583@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 [thread overview]
Message-ID: <83efzjw7cz.fsf@gnu.org> (raw)
In-Reply-To: <m3h94g2pij.fsf@stories> (message from Lars Ingebrigtsen on Mon, 30 Jan 2017 22:42:44 +0100)
> From: Lars Ingebrigtsen <larsi@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.
next prev parent reply other threads:[~2017-01-31 15:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-30 21:42 bug#25583: 26.0.50; :width/:max-width and vice versa in images Lars Ingebrigtsen
2017-01-31 15:56 ` Eli Zaretskii [this message]
2017-01-31 16:02 ` Lars Ingebrigtsen
2017-07-15 0:48 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83efzjw7cz.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=25583@debbugs.gnu.org \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).