unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18333: 24.3.93; ImageMagick: ICO image in multiple sizes is not shown correctly
@ 2014-08-27  0:50 YAMAMOTO Mitsuharu
  2019-09-24 17:22 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: YAMAMOTO Mitsuharu @ 2014-08-27  0:50 UTC (permalink / raw)
  To: 18333

Steps to Reproduce:

1. Build Emacs with the ImageMagick support.

2. Download http://bits.wikimedia.org/favicon/wikipedia.ico and save
   it to "~/wikipedia.ico"

3. $ identify ~/wikipedia.ico

   The result would be:
    wikipedia.ico[0] ICO 16x16 16x16+0+0 32-bit sRGB 15.1KB 0.000u 0:00.000
    wikipedia.ico[1] ICO 32x32 32x32+0+0 32-bit sRGB 15.1KB 0.000u 0:00.000
    wikipedia.ico[2] ICO 48x48 48x48+0+0 32-bit sRGB 15.1KB 0.000u 0:00.000

   Note that the file contains multiple images in different sizes.

4. Invoke Emacs and evaluate the following expression in *scratch*:

    (let (sizes)
      (dotimes (i 3)
	(push (image-size
	       (create-image "~/wikipedia.ico" 'imagemagick nil :index i) t)
	      sizes))
      sizes)

   The expected result is ((16 . 16) (32 . 32) (48 . 48)) or its
   permutation, but the actual one is ((16 . 16) (16 . 16) (16 . 16)).

If you try 

  (dotimes (i 3)
    (insert-image (create-image "~/wikipedia.ico" 'imagemagick nil :index i)))

then you'll observe that larger images are clipped.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

In GNU Emacs 24.3.93.1 (x86_64-apple-darwin10.8.0, GTK+ Version 3.12.2)
 of 2014-08-27 on yamamoto-mitsuharu-no-iMac.local
Windowing system distributor `The X.Org Foundation', version 11.0.10402000
Configured using:
 `configure CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib'





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#18333: 24.3.93; ImageMagick: ICO image in multiple sizes is not shown correctly
  2014-08-27  0:50 bug#18333: 24.3.93; ImageMagick: ICO image in multiple sizes is not shown correctly YAMAMOTO Mitsuharu
@ 2019-09-24 17:22 ` Lars Ingebrigtsen
  2019-09-24 17:49   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-09-24 17:22 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: 18333

YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:

> 4. Invoke Emacs and evaluate the following expression in *scratch*:
>
>     (let (sizes)
>       (dotimes (i 3)
> 	(push (image-size
> 	       (create-image "~/wikipedia.ico" 'imagemagick nil :index i) t)
> 	      sizes))
>       sizes)
>
>    The expected result is ((16 . 16) (32 . 32) (48 . 48)) or its
>    permutation, but the actual one is ((16 . 16) (16 . 16) (16 . 16)).

This bug is still present in Emacs 27.

imagemagick_compute_animated_image (which gets the data out of
multi-image files) assumes that all the images have the same size,
because it was written to handle animated GIFs (where this is the
case).  But for ico files, the logic is wrong.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#18333: 24.3.93; ImageMagick: ICO image in multiple sizes is not shown correctly
  2019-09-24 17:22 ` Lars Ingebrigtsen
@ 2019-09-24 17:49   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-09-24 17:49 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: 18333

[-- Attachment #1: Type: text/plain, Size: 1123 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:

> YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:
>
>> 4. Invoke Emacs and evaluate the following expression in *scratch*:
>>
>>     (let (sizes)
>>       (dotimes (i 3)
>> 	(push (image-size
>> 	       (create-image "~/wikipedia.ico" 'imagemagick nil :index i) t)
>> 	      sizes))
>>       sizes)
>>
>>    The expected result is ((16 . 16) (32 . 32) (48 . 48)) or its
>>    permutation, but the actual one is ((16 . 16) (16 . 16) (16 . 16)).
>
> This bug is still present in Emacs 27.
>
> imagemagick_compute_animated_image (which gets the data out of
> multi-image files) assumes that all the images have the same size,
> because it was written to handle animated GIFs (where this is the
> case).  But for ico files, the logic is wrong.

I've now fixed this on the Emacs trunk.  The ImageMagick code now
distinguishes between animated files (where all sub-images are the same
size) and non-animated files (where this may be different).

Results included below.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

[-- Attachment #2: multi.jpg --]
[-- Type: image/jpeg, Size: 19767 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-24 17:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-27  0:50 bug#18333: 24.3.93; ImageMagick: ICO image in multiple sizes is not shown correctly YAMAMOTO Mitsuharu
2019-09-24 17:22 ` Lars Ingebrigtsen
2019-09-24 17:49   ` Lars Ingebrigtsen

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).