unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Thomas Hühn" <t@2uo.de>
To: 58101@debbugs.gnu.org
Cc: Eli Zaretskii <eliz@gnu.org>
Subject: bug#58101: 28.2; image-size nonsensical
Date: Tue, 27 Sep 2022 11:00:22 +0200	[thread overview]
Message-ID: <1a31e408-ea01-7e86-d6ac-e45fda14ddb5@2uo.de> (raw)
In-Reply-To: <83tu4tjqsh.fsf@gnu.org>

Hi,

first of all, I think this bug could be merged with #52931, I found that 
only afterwards.

On 27.09.2022 08:05, Eli Zaretskii wrote:
>> Date: Mon, 26 Sep 2022 20:41:45 +0200
>> From: Thomas Hühn <t@2uo.de>
>>
>> * Download image https://imgs.xkcd.com/comics/two_key_system_2x.png to
>>     disk
>>
>> * Run (create-image "two_key_system_2x.png") --> (image :type png :file
>>     "two_key_system_2x.png" :scale 1.2038461538461538 :transform-smoothing
>>     t)
>>
>> * Run (image-size (create-image "two_key_system_2x.png") :pixels) -->
>>     (30 . 30)
>>
>> Expected result: (1291 . 632)
> 
> I cannot reproduce this here.  I get the expected result.  I also get

Now it seems like it's an intermittent problem.

Until yesterday (for several weaks where I've tried it every now and 
then) it resulted in what I wrote in this bug.

Then I found #52931 and tried Markus' lines.

In my opinion,

(image-size (create-image "two_key_system_2x.png") :pixels)

and

(let ((img (create-image "two_key_system_2x.png")))
   (image-size img t))

should give the same result, but it didn't! Markus' line gave 1554 . 
760, mine gave 30 . 30.

Later yesterday evening both gave 1554 . 760.

After some googling I found image-scaling-factor, and after setting that 
to 1, I always get the expected 1291 . 632 now.

(By the way, I think image-size should ignore that variable – I'm not 
displaying the image anywhere, so any display scaling shouldn't 
interfere – my use case would be inserting width and height attributes 
in HTML where I certainly want the original image dimensions)

> this result from create-image:
> 
>   (image :type png :file "two_key_system_2x.png" :scale 1 :transform-smoothing t)

With emacs -Q:

(image :type png :file "two_key_system_2x.png" :scale 1.2 
:transform-smoothing t)

That scaling factor is different now. I'll continue with emacs -Q from 
now on.

> Is this in "emacs -Q"?  If so, what version of libpng do you have

mingw64/mingw-w64-x86_64-libpng 1.6.38-1 [installed]

> installed there?  And what happens if you start Emacs like this:
> 
>    emacs -Q --eval "(setq w32-use-native-image-API t)"

(image-size (create-image "two_key_system_2x.png") :pixels)
--> (1549 . 758)

(let ((img (create-image "two_key_system_2x.png")))
   (image-size img t))
--> (1549 . 758)

Have a nice day!
Thomas
-- 
Wunderschön illustrierte Kinderbücher:
https://www.schoene-kinderbuecher.de
Weblog:
https://www.thomas-huehn.de





  reply	other threads:[~2022-09-27  9:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26 18:41 bug#58101: 28.2; image-size nonsensical Thomas Hühn
2022-09-27  6:05 ` Eli Zaretskii
2022-09-27  9:00   ` Thomas Hühn [this message]
2022-09-27  9:19     ` Eli Zaretskii
2022-09-27  9:21       ` Thomas Hühn
2022-09-27  9:39         ` Eli Zaretskii
2022-09-27 11:57           ` Lars Ingebrigtsen
2022-09-27 12:14             ` Eli Zaretskii
2022-09-27 12:25             ` Thomas Hühn
2022-09-27 12:28               ` Lars Ingebrigtsen
2022-09-27 12:30                 ` Thomas Hühn
2022-09-27 12:36                   ` Lars Ingebrigtsen
2022-09-27 12:50                     ` Thomas Hühn
2022-09-27 12:51                       ` Lars Ingebrigtsen
2022-09-27 14:28             ` Stefan Kangas
2022-09-27 15:41               ` Lars Ingebrigtsen
2022-09-27 15:42               ` Eli Zaretskii

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=1a31e408-ea01-7e86-d6ac-e45fda14ddb5@2uo.de \
    --to=t@2uo.de \
    --cc=58101@debbugs.gnu.org \
    --cc=eliz@gnu.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).