GNU bug report logs - #1701
problem computing image dimension of huge jpeg file

Previous Next

Package: emacs;

Reported by: xah lee <xah <at> xahlee.org>

Date: Thu, 25 Dec 2008 18:25:04 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1701 in the body.
You can then email your comments to 1701 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1701; Package emacs. (Thu, 25 Dec 2008 18:25:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to xah lee <xah <at> xahlee.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 25 Dec 2008 18:25:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: xah lee <xah <at> xahlee.org>
To: bug-gnu-emacs <at> gnu.org
Subject: problem computing image dimension of huge jpeg file
Date: Thu, 25 Dec 2008 10:19:29 -0800
this appears to be a bug.

Summary: emacs seems to have some limitation when trying to compute a  
jpeg image's width and height when the image is huge.

Sorry i haven't had time to narrow down exactly where is the bug, but  
here's a short description with my elisp code that this problem happens.

When using the following code full-size-img-linkify (see code below)  
on a large image that is 4248x544, but emacs report it as 30x30.

This has happened to me once before on another image. When i try to  
open the image in emacs, emacs doesn't display it. So, the problem  
may simply be that emacs can't properly decode the file. (as far as i  
know, the image is not corrupt since i can view it in 2 other image  
viewer programs)

Here's steps to reproduce:

• download the image here:
wget -U "Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.9.0.4)  
Gecko/2008102920 Firefox/3.0.4" http://xahlee.org/Whirlwheel_dir/ 
livermore/livermore.jpg

(the image is available here http://xahlee.org/Whirlwheel_dir/ 
livermore.html but if you use wget you need to give mozilla agent  
string)

• save the image to disk in a directory, let's say named xxx.

• create a html file in the dir xxx, say call it test.html

• insert the text “livermore.jpg” (without the quotes) into the  
file, then press return.

• now move cursor to the line. Then M-x full-size-img-linkify.

Emacs should change the line to this:
<a class="lgimg" href="livermore.jpg" title="30x30">❐</a>

but what's expected is this:
<a class="lgimg" href="livermore.jpg" title="4248x544">❐</a>


In GNU Emacs 22.2.1 (powerpc-apple-darwin8.11.0, Carbon Version 1.6.0)
 of 2008-04-05 on g5.tokyo.stp.isas.jaxa.jp
Windowing system distributor `Apple Inc.', version 10.4.11

pasted below is the function

(defun full-size-img-linkify ()
  "Make img file path at cursor point into a img link.

Example:
i/goddesses.jpg
becomes
<a class=\"lgimg\" href=\"i/goddesses.jpg\" title=\"622x800\">❐</a>

If region is active, use region as file name.
"
  (interactive)
  (let
    (imgPath imgfName linkText bds imgDimen width height myResult)

    (setq bds
          (if (and transient-mark-mode mark-active)
              (cons (region-beginning) (region-end))
            (bounds-of-thing-at-point 'filename)
            ))

    (setq imgPath
          (buffer-substring-no-properties (car bds) (cdr bds))
          )

    (setq imgfName (file-name-nondirectory imgPath))
    ;; (setq linkText
;;           (if (< (length imgfName) 20)
;;               imgfName
;;             (concat  (substring imgfName 0 5)  "..." (substring  
imgfName -6)  ) ))
    (setq imgDimen (get-image-dimensions imgPath))
    (setq width (number-to-string (car imgDimen)))
    (setq height (number-to-string (car (last imgDimen))))
    (setq myResult (concat "<a class=\"lgimg\" href=\"" imgPath "\"  
"  "title=" "\"" width "x" height "\"" ">❐</a>"))

    (delete-region (car bds) (cdr bds))
    (insert myResult)
    ))

  Xah
∑ http://xahlee.org/

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1701; Package emacs. (Fri, 26 Dec 2008 17:15:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Schwab <schwab <at> suse.de>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 26 Dec 2008 17:15:04 GMT) Full text and rfc822 format available.

Message #10 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: xah lee <xah <at> xahlee.org>
Cc: 1701 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
Subject: Re: bug#1701: problem computing image dimension of huge jpeg file
Date: Fri, 26 Dec 2008 18:04:59 +0100
xah lee <xah <at> xahlee.org> writes:

> When using the following code full-size-img-linkify (see code below) on a
> large image that is 4248x544, but emacs report it as 30x30.

You should report that to the author of the get-image-dimensions
function.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab <at> suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1701; Package emacs. (Fri, 26 Dec 2008 17:15:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Schwab <schwab <at> suse.de>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 26 Dec 2008 17:15:05 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to xah lee <xah <at> xahlee.org> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Sat, 27 Dec 2008 14:30:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Sat, 24 Jan 2009 15:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 228 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.