unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* unable to open jpg file
@ 2008-01-13  2:58 xah lee
  2008-01-14  2:01 ` Richard Stallman
  2008-01-14  3:29 ` YAMAMOTO Mitsuharu
  0 siblings, 2 replies; 11+ messages in thread
From: xah lee @ 2008-01-13  2:58 UTC (permalink / raw)
  To: emacs-pretest-bug

I open a jpg file, and emacs reports:

File mode specification error: (error "Invalid image specification")

I do not know whether this jpg file is considered techincally  
corrupt, but i can open it in any image program without getting a  
error, including: ImageMagick, Gimp, Mac's Preview and GraphicConverter.

This is not the only image that emacs report this error. There are many.

I'm sorry, but the image in question is porn. I don't have examples  
that's not porn. Just go to youporn.com and drag any of their  
thumbnail to disk, it should result a jpg, then try open it in emacs.

   Xah
   xah@xahlee.org
∑ http://xahlee.org/


In GNU Emacs 22.1.50.1 (powerpc-apple-darwin8.10.0, Carbon Version  
1.6.0)
  of 2007-11-06 on cf-ppc-macosx.usr.sourceforge.jp
Windowing system distributor `Apple Inc.', version 10.4.11
configured using `configure  '--prefix=/Applications/Emacs.app/ 
Contents/Resources' '--with-carbon' '--without-x' '--libexecdir=/ 
Volumes/Emacs/Emacs.app/Contents/MacOS/libexec' 'CFLAGS=-arch i386 - 
arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -DUSE_ATSUI - 
DUSE_MAC_TSM''


Recent messages:
Mark saved where search started
Mark set
Wrote /Users/xah/web/PageTwo_dir/Personal_dir/porn_movies.html
Mark set
Wrote /Users/xah/web/PageTwo_dir/Personal_dir/porn_movies.html
Mark saved where search started
Mark set
Wrote /Users/xah/web/PageTwo_dir/Personal_dir/porn_movies.html [2 times]
File mode specification error: (error "Invalid image specification")  
[3 times]
Making completion list...


☄

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

* Re: unable to open jpg file
  2008-01-13  2:58 unable to open jpg file xah lee
@ 2008-01-14  2:01 ` Richard Stallman
  2008-01-14  3:29 ` YAMAMOTO Mitsuharu
  1 sibling, 0 replies; 11+ messages in thread
From: Richard Stallman @ 2008-01-14  2:01 UTC (permalink / raw)
  To: xah lee; +Cc: emacs-pretest-bug

    I'm sorry, but the image in question is porn.

Could you send it to someone who wants to debug this?

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

* Re: unable to open jpg file
  2008-01-13  2:58 unable to open jpg file xah lee
  2008-01-14  2:01 ` Richard Stallman
@ 2008-01-14  3:29 ` YAMAMOTO Mitsuharu
  2008-01-14  3:55   ` xah lee
  1 sibling, 1 reply; 11+ messages in thread
From: YAMAMOTO Mitsuharu @ 2008-01-14  3:29 UTC (permalink / raw)
  To: xah lee; +Cc: emacs-pretest-bug

>>>>> On Sat, 12 Jan 2008 18:58:29 -0800, xah lee <xah@xahlee.org> said:

> I open a jpg file, and emacs reports: File mode specification error:
> (error "Invalid image specification")

Please describe the concrete operation of `opening a jpg file' that
causes the problem.

> I do not know whether this jpg file is considered techincally
> corrupt, but i can open it in any image program without getting a
> error, including: ImageMagick, Gimp, Mac's Preview and
> GraphicConverter.

> This is not the only image that emacs report this error. There are
> many.

> I'm sorry, but the image in question is porn. I don't have examples
> that's not porn. Just go to youporn.com and drag any of their
> thumbnail to disk, it should result a jpg, then try open it in
> emacs.

Could you show an example URL of a moderate image among them?

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

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

* Re: unable to open jpg file
  2008-01-14  3:29 ` YAMAMOTO Mitsuharu
@ 2008-01-14  3:55   ` xah lee
  2008-01-14  4:27     ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 11+ messages in thread
From: xah lee @ 2008-01-14  3:55 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-pretest-bug

> Please describe the concrete operation of `opening a jpg file' that
> causes the problem.


I go to dired, then press enter on the jpg file's name. Or, i use the  
M-x find-file to open the file.

anyway, to see a image, go to
http://xahlee.org/PageTwo_dir/Personal_dir/porn_movies.html (explicit  
porn)

all the thumbnails at the bottom won't open.

(single image won't work with my server setting unless you use wget  
with agent string of a browser and referral string of xahlee.org, but  
the image names and all images are all hardcore anyway ...)

   Xah
   xah@xahlee.org
∑ http://xahlee.org/



On Jan 13, 2008, at 7:29 PM, YAMAMOTO Mitsuharu wrote:

>>>>> On Sat, 12 Jan 2008 18:58:29 -0800, xah lee <xah@xahlee.org> said:

> I open a jpg file, and emacs reports: File mode specification error:
> (error "Invalid image specification")

Please describe the concrete operation of `opening a jpg file' that
causes the problem.

> I do not know whether this jpg file is considered techincally
> corrupt, but i can open it in any image program without getting a
> error, including: ImageMagick, Gimp, Mac's Preview and
> GraphicConverter.

> This is not the only image that emacs report this error. There are
> many.

> I'm sorry, but the image in question is porn. I don't have examples
> that's not porn. Just go to youporn.com and drag any of their
> thumbnail to disk, it should result a jpg, then try open it in
> emacs.

Could you show an example URL of a moderate image among them?

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

☄

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

* Re: unable to open jpg file
  2008-01-14  3:55   ` xah lee
@ 2008-01-14  4:27     ` YAMAMOTO Mitsuharu
  2008-01-14 13:20       ` Jason Rumney
  2008-01-14 17:26       ` Richard Stallman
  0 siblings, 2 replies; 11+ messages in thread
From: YAMAMOTO Mitsuharu @ 2008-01-14  4:27 UTC (permalink / raw)
  To: xah lee; +Cc: emacs-pretest-bug

>>>>> On Sun, 13 Jan 2008 19:55:41 -0800, xah lee <xah@xahlee.org> said:

>> Please describe the concrete operation of `opening a jpg file' that
>> causes the problem.


> I go to dired, then press enter on the jpg file's name. Or, i use
> the M-x find-file to open the file.

> anyway, to see a image, go to
> http://xahlee.org/PageTwo_dir/Personal_dir/porn_movies.html
> (explicit porn)

> all the thumbnails at the bottom won't open.

As image-jpeg-p returns nil for that image data (no "JFIF" or "Exif"
as a substring), it couldn't be displayed even with the X11 version,
either.  As this is not Carbon-specific, I would like to leave the
issue to those who are more familiar with image.el and/or image format
spec.

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

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

* Re: unable to open jpg file
  2008-01-14  4:27     ` YAMAMOTO Mitsuharu
@ 2008-01-14 13:20       ` Jason Rumney
  2008-01-14 13:42         ` xah lee
  2008-01-14 22:36         ` James Cloos
  2008-01-14 17:26       ` Richard Stallman
  1 sibling, 2 replies; 11+ messages in thread
From: Jason Rumney @ 2008-01-14 13:20 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: xah lee, emacs-pretest-bug

YAMAMOTO Mitsuharu wrote:
> As image-jpeg-p returns nil for that image data (no "JFIF" or "Exif"
> as a substring), it couldn't be displayed even with the X11 version,
> either.  As this is not Carbon-specific, I would like to leave the
> issue to those who are more familiar with image.el and/or image format
> spec.
>   

I found some more work friendly non-JFIF/Exif JPEG images here:

http://www.marysvilletourism.com/media/index.htm

Firefox and Emacs 22 fail to display these images, but Emacs trunk 
displays them (is this the case with the images in the original report?).

The difference between Emacs 22 and trunk seems to be in the function 
image-type. In Emacs 22, if the image headers do not determine the type, 
we convert the file extension to a symbol and use that. This means .jpg 
files are given a type of 'jpg, which is not the correct image-type for 
jpeg images.

The trunk has been changed to use image-type-from-file-name instead, 
which correctly returns 'jpeg for that image.

I have backported that change to emacs-22.

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

* Re: unable to open jpg file
  2008-01-14 13:20       ` Jason Rumney
@ 2008-01-14 13:42         ` xah lee
  2008-01-14 22:36         ` James Cloos
  1 sibling, 0 replies; 11+ messages in thread
From: xah lee @ 2008-01-14 13:42 UTC (permalink / raw)
  To: Jason Rumney; +Cc: emacs-pretest-bug, YAMAMOTO Mitsuharu

I followed your instruction and that fixed the problem for my  
original images.

Thanks.

   Xah
   xah@xahlee.org
∑ http://xahlee.org/


On Jan 14, 2008, at 5:20 AM, Jason Rumney wrote:

YAMAMOTO Mitsuharu wrote:
> As image-jpeg-p returns nil for that image data (no "JFIF" or "Exif"
> as a substring), it couldn't be displayed even with the X11 version,
> either.  As this is not Carbon-specific, I would like to leave the
> issue to those who are more familiar with image.el and/or image format
> spec.
>

I found some more work friendly non-JFIF/Exif JPEG images here:

http://www.marysvilletourism.com/media/index.htm

Firefox and Emacs 22 fail to display these images, but Emacs trunk  
displays them (is this the case with the images in the original  
report?).

The difference between Emacs 22 and trunk seems to be in the function  
image-type. In Emacs 22, if the image headers do not determine the  
type, we convert the file extension to a symbol and use that. This  
means .jpg files are given a type of 'jpg, which is not the correct  
image-type for jpeg images.

The trunk has been changed to use image-type-from-file-name instead,  
which correctly returns 'jpeg for that image.

I have backported that change to emacs-22.


☄

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

* Re: unable to open jpg file
  2008-01-14  4:27     ` YAMAMOTO Mitsuharu
  2008-01-14 13:20       ` Jason Rumney
@ 2008-01-14 17:26       ` Richard Stallman
  2008-01-14 23:15         ` Jason Rumney
  1 sibling, 1 reply; 11+ messages in thread
From: Richard Stallman @ 2008-01-14 17:26 UTC (permalink / raw)
  To: emacs-pretest-bug

Would someone please DTRT and ack?

> I go to dired, then press enter on the jpg file's name. Or, i use
> the M-x find-file to open the file.

> anyway, to see a image, go to
> http://xahlee.org/PageTwo_dir/Personal_dir/porn_movies.html
> (explicit porn)

> all the thumbnails at the bottom won't open.

As image-jpeg-p returns nil for that image data (no "JFIF" or "Exif"
as a substring), it couldn't be displayed even with the X11 version,
either.  As this is not Carbon-specific, I would like to leave the
issue to those who are more familiar with image.el and/or image format
spec.

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

* Re: unable to open jpg file
  2008-01-14 13:20       ` Jason Rumney
  2008-01-14 13:42         ` xah lee
@ 2008-01-14 22:36         ` James Cloos
  2008-01-15 16:08           ` Tom Tromey
  1 sibling, 1 reply; 11+ messages in thread
From: James Cloos @ 2008-01-14 22:36 UTC (permalink / raw)
  To: emacs-pretest-bug; +Cc: xah lee, YAMAMOTO Mitsuharu, Jason Rumney

File(1)'s magic file says this, for detecting jpegs:

,----[ excerpt from /usr/share/misc/file/magic ]
| # JPEG images
| # SunOS 5.5.1 had
| #
| #       0       string          \377\330\377\340        JPEG file
| #       0       string          \377\330\377\356        JPG file
| #
| # both of which turn into "JPEG image data" here.
| #
| 0       beshort         0xffd8          JPEG image data
| >6      string          JFIF            \b, JFIF standard
`----

So rather than searching for JFIF or EXIF emacs should test the first
two or four octets for the real magic cookie.

Magic.mime(4), used to determine the MIME type of a file, also only
tests the first two octets for 0xff and 0xd8.  It should be enough,
then, for Emacs to test only those two octets as well.

Incidently, file(1) is under a 2-clause BSD-style license; incorporating
the magic.mime file and using that to determine how to open files might
make for a more robust -- or at least well-tested -- system.

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6

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

* Re: unable to open jpg file
  2008-01-14 17:26       ` Richard Stallman
@ 2008-01-14 23:15         ` Jason Rumney
  0 siblings, 0 replies; 11+ messages in thread
From: Jason Rumney @ 2008-01-14 23:15 UTC (permalink / raw)
  To: rms; +Cc: emacs-pretest-bug

Richard Stallman wrote:
> Would someone please DTRT and ack?
>   

Fixed earlier today.

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

* Re: unable to open jpg file
  2008-01-14 22:36         ` James Cloos
@ 2008-01-15 16:08           ` Tom Tromey
  0 siblings, 0 replies; 11+ messages in thread
From: Tom Tromey @ 2008-01-15 16:08 UTC (permalink / raw)
  To: James Cloos; +Cc: xah lee, emacs-pretest-bug, YAMAMOTO Mitsuharu, Jason Rumney

>>>>> "James" == James Cloos <cloos@jhcloos.com> writes:

James> Incidently, file(1) is under a 2-clause BSD-style license; incorporating
James> the magic.mime file and using that to determine how to open files might
James> make for a more robust -- or at least well-tested -- system.

You could also use libmagic directly and not have to reimplement the
magic.mime parsing stuff.  That's what we did in libgcj.

Tom

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

end of thread, other threads:[~2008-01-15 16:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-13  2:58 unable to open jpg file xah lee
2008-01-14  2:01 ` Richard Stallman
2008-01-14  3:29 ` YAMAMOTO Mitsuharu
2008-01-14  3:55   ` xah lee
2008-01-14  4:27     ` YAMAMOTO Mitsuharu
2008-01-14 13:20       ` Jason Rumney
2008-01-14 13:42         ` xah lee
2008-01-14 22:36         ` James Cloos
2008-01-15 16:08           ` Tom Tromey
2008-01-14 17:26       ` Richard Stallman
2008-01-14 23:15         ` Jason Rumney

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