From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#25583: 26.0.50; :width/:max-width and vice versa in images Date: Tue, 31 Jan 2017 17:56:44 +0200 Message-ID: <83efzjw7cz.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1485879169 32650 195.159.176.226 (31 Jan 2017 16:12:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 31 Jan 2017 16:12:49 +0000 (UTC) Cc: 25583@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 31 17:12:45 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYb2y-0008Hs-Fw for geb-bug-gnu-emacs@m.gmane.org; Tue, 31 Jan 2017 17:12:44 +0100 Original-Received: from localhost ([::1]:39263 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYb33-0008IR-QG for geb-bug-gnu-emacs@m.gmane.org; Tue, 31 Jan 2017 11:12:49 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYaoo-0003s4-QG for bug-gnu-emacs@gnu.org; Tue, 31 Jan 2017 10:58:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYaoj-0003QV-VV for bug-gnu-emacs@gnu.org; Tue, 31 Jan 2017 10:58:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54190) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cYaoj-0003QR-Rm for bug-gnu-emacs@gnu.org; Tue, 31 Jan 2017 10:58:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cYaoj-0006ho-LU for bug-gnu-emacs@gnu.org; Tue, 31 Jan 2017 10:58:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 31 Jan 2017 15:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25583 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25583-submit@debbugs.gnu.org id=B25583.148587824125721 (code B ref 25583); Tue, 31 Jan 2017 15:58:01 +0000 Original-Received: (at 25583) by debbugs.gnu.org; 31 Jan 2017 15:57:21 +0000 Original-Received: from localhost ([127.0.0.1]:52389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYao4-0006gn-Up for submit@debbugs.gnu.org; Tue, 31 Jan 2017 10:57:21 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:48772) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYao3-0006ga-4a for 25583@debbugs.gnu.org; Tue, 31 Jan 2017 10:57:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYant-00036v-6V for 25583@debbugs.gnu.org; Tue, 31 Jan 2017 10:57:14 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:49139) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYant-00036q-4I; Tue, 31 Jan 2017 10:57:09 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4917 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cYanr-00045t-UF; Tue, 31 Jan 2017 10:57:08 -0500 In-reply-to: (message from Lars Ingebrigtsen on Mon, 30 Jan 2017 22:42:44 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:128832 Archived-At: > From: Lars Ingebrigtsen > 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.