unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Image file name extension not recognized
@ 2007-02-03  0:49 Vinicius Jose Latorre
  2007-02-03  1:03 ` Chong Yidong
  2007-02-03  1:06 ` Juanma Barranquero
  0 siblings, 2 replies; 13+ messages in thread
From: Vinicius Jose Latorre @ 2007-02-03  0:49 UTC (permalink / raw)
  To: emacs-devel

Hi,


Well, I don't know if this is a bug.

I have some image files with names like:

    IMG_0366.JPG

When I try to open it, Emacs does not recognize it as an image file.

But if I rename the file to:

    IMG_0366.jpg

Then Emacs recognizes the file as an image file.

Shouldn't Emacs recognize files with .JPG extension as an image file?


Vinicius

PS: I'm using GNU/Linux and I got the image from my digital camera.

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

* Re: Image file name extension not recognized
  2007-02-03  0:49 Image file name extension not recognized Vinicius Jose Latorre
@ 2007-02-03  1:03 ` Chong Yidong
  2007-02-03  1:42   ` Vinicius Jose Latorre
  2007-02-03  1:06 ` Juanma Barranquero
  1 sibling, 1 reply; 13+ messages in thread
From: Chong Yidong @ 2007-02-03  1:03 UTC (permalink / raw)
  To: Vinicius Jose Latorre; +Cc: emacs-devel

Vinicius Jose Latorre <viniciusjl@ig.com.br> writes:

> I have some image files with names like:
>
>    IMG_0366.JPG
>
> When I try to open it, Emacs does not recognize it as an image file.
>
> But if I rename the file to:
>
>    IMG_0366.jpg
>
> Then Emacs recognizes the file as an image file.
>
> Shouldn't Emacs recognize files with .JPG extension as an image file?

Jpeg images are supposed to be autodetected using their contents, even
if the file extension is JPG (see image-type-header-regexps).
Apparently, that autodetection is failing in this case.  Could you try
to find out why?

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

* Re: Image file name extension not recognized
  2007-02-03  0:49 Image file name extension not recognized Vinicius Jose Latorre
  2007-02-03  1:03 ` Chong Yidong
@ 2007-02-03  1:06 ` Juanma Barranquero
  2007-02-03  1:18   ` Vinicius Jose Latorre
  1 sibling, 1 reply; 13+ messages in thread
From: Juanma Barranquero @ 2007-02-03  1:06 UTC (permalink / raw)
  To: Vinicius Jose Latorre; +Cc: emacs-devel

On 2/3/07, Vinicius Jose Latorre <viniciusjl@ig.com.br> wrote:

> Shouldn't Emacs recognize files with .JPG extension as an image file?

If you load the file and execute "M-: (set-auto-mode) RET", does it
return `image-mode-maybe'? And does running `image-mode-maybe' on this
buffer turn image-mode on?

                    /L/e/k/t/u

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

* Re: Image file name extension not recognized
  2007-02-03  1:06 ` Juanma Barranquero
@ 2007-02-03  1:18   ` Vinicius Jose Latorre
  2007-02-03  1:43     ` Chong Yidong
  0 siblings, 1 reply; 13+ messages in thread
From: Vinicius Jose Latorre @ 2007-02-03  1:18 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: emacs-devel

Juanma Barranquero wrote:
> On 2/3/07, Vinicius Jose Latorre <viniciusjl@ig.com.br> wrote:
>
>> Shouldn't Emacs recognize files with .JPG extension as an image file?
>
> If you load the file and execute "M-: (set-auto-mode) RET", does it
> return `image-mode-maybe'? And does running `image-mode-maybe' on this
> buffer turn image-mode on?
>
>                    /L/e/k/t/u

Executing  M-: (set-auto-mode) RET  , return nil.

Executing  M-x image-mode RET  , turn image-mode on.

BTW, the very first characters in the file are:

    \377\330\377\341^S\376Exif^@^@II*^@^H^@^@^@

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

* Re: Image file name extension not recognized
  2007-02-03  1:03 ` Chong Yidong
@ 2007-02-03  1:42   ` Vinicius Jose Latorre
  2007-02-03  1:46     ` Chong Yidong
  2007-02-03  1:49     ` Vinicius Jose Latorre
  0 siblings, 2 replies; 13+ messages in thread
From: Vinicius Jose Latorre @ 2007-02-03  1:42 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

Chong Yidong wrote:
> Vinicius Jose Latorre <viniciusjl@ig.com.br> writes:
>
>   
>> I have some image files with names like:
>>
>>    IMG_0366.JPG
>>
>> When I try to open it, Emacs does not recognize it as an image file.
>>
>> But if I rename the file to:
>>
>>    IMG_0366.jpg
>>
>> Then Emacs recognizes the file as an image file.
>>
>> Shouldn't Emacs recognize files with .JPG extension as an image file?
>>     
>
> Jpeg images are supposed to be autodetected using their contents, even
> if the file extension is JPG (see image-type-header-regexps).
> Apparently, that autodetection is failing in this case.  Could you try
> to find out why?

The image-type-header-regexps variable has the value:

  '(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm)
    ("\\`P[1-6]" . pbm)
    ("\\`GIF8" . gif)
    ("\\`\211PNG\r\n" . png)
    ("\\`[\t\n\r ]*#define" . xbm)
    ("\\`\\(MM\0\\*\\|II\\*\0\\)" . tiff)
    ("\\`[\t\n\r ]*%!PS" . postscript)
    ("\\`\xff\xd8" . (image-jpeg-p . jpeg)))

Where image-jpeg-p is a function.

I just type  M-x debug-on-entry RET image-jpeg-p RET

Then tried to open the file again and image-jpeg-p is not called.

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

* Re: Image file name extension not recognized
  2007-02-03  1:18   ` Vinicius Jose Latorre
@ 2007-02-03  1:43     ` Chong Yidong
  2007-02-03  1:51       ` Vinicius Jose Latorre
  0 siblings, 1 reply; 13+ messages in thread
From: Chong Yidong @ 2007-02-03  1:43 UTC (permalink / raw)
  To: Vinicius Jose Latorre; +Cc: Juanma Barranquero, emacs-devel

Vinicius Jose Latorre <viniciusjl@ig.com.br> writes:

> Executing  M-: (set-auto-mode) RET  , return nil.
>
> Executing  M-x image-mode RET  , turn image-mode on.
>
> BTW, the very first characters in the file are:
>
>    \377\330\377\341^S\376Exif^@^@II*^@^H^@^@^@

What does

(image-jpeg-p (buffer-string))

return?

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

* Re: Image file name extension not recognized
  2007-02-03  1:42   ` Vinicius Jose Latorre
@ 2007-02-03  1:46     ` Chong Yidong
  2007-02-03  2:14       ` Vinicius Jose Latorre
  2007-02-03  1:49     ` Vinicius Jose Latorre
  1 sibling, 1 reply; 13+ messages in thread
From: Chong Yidong @ 2007-02-03  1:46 UTC (permalink / raw)
  To: Vinicius Jose Latorre; +Cc: emacs-devel

Vinicius Jose Latorre <viniciusjl@ig.com.br> writes:

> The image-type-header-regexps variable has the value:
>
>  '(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm)
>    ("\\`P[1-6]" . pbm)
>    ("\\`GIF8" . gif)
>    ("\\`\211PNG\r\n" . png)
>    ("\\`[\t\n\r ]*#define" . xbm)
>    ("\\`\\(MM\0\\*\\|II\\*\0\\)" . tiff)
>    ("\\`[\t\n\r ]*%!PS" . postscript)
>    ("\\`\xff\xd8" . (image-jpeg-p . jpeg)))
>
> Where image-jpeg-p is a function.
>
> I just type  M-x debug-on-entry RET image-jpeg-p RET
>
> Then tried to open the file again and image-jpeg-p is not called.

I cannot reproduce this.  I also have files saved with extension .JPG,
and image-jpeg-p does get called.  Can you try rebuilding Emacs from
the latest CVS sources and trying with "emacs -Q"?

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

* Re: Image file name extension not recognized
  2007-02-03  1:42   ` Vinicius Jose Latorre
  2007-02-03  1:46     ` Chong Yidong
@ 2007-02-03  1:49     ` Vinicius Jose Latorre
  1 sibling, 0 replies; 13+ messages in thread
From: Vinicius Jose Latorre @ 2007-02-03  1:49 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

Vinicius Jose Latorre wrote:
> Chong Yidong wrote:
>> Vinicius Jose Latorre <viniciusjl@ig.com.br> writes:
>>
>>  
>>> I have some image files with names like:
>>>
>>>    IMG_0366.JPG
>>>
>>> When I try to open it, Emacs does not recognize it as an image file.
>>>
>>> But if I rename the file to:
>>>
>>>    IMG_0366.jpg
>>>
>>> Then Emacs recognizes the file as an image file.
>>>
>>> Shouldn't Emacs recognize files with .JPG extension as an image file?
>>>     
>>
>> Jpeg images are supposed to be autodetected using their contents, even
>> if the file extension is JPG (see image-type-header-regexps).
>> Apparently, that autodetection is failing in this case.  Could you try
>> to find out why?
>
> The image-type-header-regexps variable has the value:
>
>  '(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm)
>    ("\\`P[1-6]" . pbm)
>    ("\\`GIF8" . gif)
>    ("\\`\211PNG\r\n" . png)
>    ("\\`[\t\n\r ]*#define" . xbm)
>    ("\\`\\(MM\0\\*\\|II\\*\0\\)" . tiff)
>    ("\\`[\t\n\r ]*%!PS" . postscript)
>    ("\\`\xff\xd8" . (image-jpeg-p . jpeg)))
>
> Where image-jpeg-p is a function.
>
> I just type  M-x debug-on-entry RET image-jpeg-p RET
>
> Then tried to open the file again and image-jpeg-p is not called.

Hummm, very interesting, if I rename the extension file to .jpg 
extension, then image-jpeg-p is called.

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

* Re: Image file name extension not recognized
  2007-02-03  1:43     ` Chong Yidong
@ 2007-02-03  1:51       ` Vinicius Jose Latorre
  2007-02-03  1:59         ` Juanma Barranquero
  0 siblings, 1 reply; 13+ messages in thread
From: Vinicius Jose Latorre @ 2007-02-03  1:51 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Juanma Barranquero, emacs-devel

Chong Yidong wrote:
> Vinicius Jose Latorre <viniciusjl@ig.com.br> writes:
>
>> Executing  M-: (set-auto-mode) RET  , return nil.
>>
>> Executing  M-x image-mode RET  , turn image-mode on.
>>
>> BTW, the very first characters in the file are:
>>
>>    \377\330\377\341^S\376Exif^@^@II*^@^H^@^@^@
>
> What does
>
> (image-jpeg-p (buffer-string))
>
> return?

3 (#o3, #x3)

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

* Re: Image file name extension not recognized
  2007-02-03  1:51       ` Vinicius Jose Latorre
@ 2007-02-03  1:59         ` Juanma Barranquero
  0 siblings, 0 replies; 13+ messages in thread
From: Juanma Barranquero @ 2007-02-03  1:59 UTC (permalink / raw)
  To: Vinicius Jose Latorre; +Cc: Chong Yidong, emacs-devel

On 2/3/07, Vinicius Jose Latorre <viniciusjl@ig.com.br> wrote:

> 3 (#o3, #x3)

This doesn't make much sense. If `image-jpeg-p' recognizes your file
as a JPEG, `image-mode-maybe' should put the file in image-mode unless
you happen to have another item in `auto-mode-alist' that matches your
file's name.

                    /L/e/k/t/u

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

* Re: Image file name extension not recognized
  2007-02-03  1:46     ` Chong Yidong
@ 2007-02-03  2:14       ` Vinicius Jose Latorre
  2007-02-03  2:35         ` Vinicius Jose Latorre
  0 siblings, 1 reply; 13+ messages in thread
From: Vinicius Jose Latorre @ 2007-02-03  2:14 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

Chong Yidong wrote:
> Vinicius Jose Latorre <viniciusjl@ig.com.br> writes:
>
>> The image-type-header-regexps variable has the value:
>>
>>  '(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm)
>>    ("\\`P[1-6]" . pbm)
>>    ("\\`GIF8" . gif)
>>    ("\\`\211PNG\r\n" . png)
>>    ("\\`[\t\n\r ]*#define" . xbm)
>>    ("\\`\\(MM\0\\*\\|II\\*\0\\)" . tiff)
>>    ("\\`[\t\n\r ]*%!PS" . postscript)
>>    ("\\`\xff\xd8" . (image-jpeg-p . jpeg)))
>>
>> Where image-jpeg-p is a function.
>>
>> I just type  M-x debug-on-entry RET image-jpeg-p RET
>>
>> Then tried to open the file again and image-jpeg-p is not called.
>
> I cannot reproduce this.  I also have files saved with extension .JPG,
> and image-jpeg-p does get called.  Can you try rebuilding Emacs from
> the latest CVS sources and trying with "emacs -Q"?

I've just downloaded via cvs the latest Emacs 22 version and rebuild it.

emacs -Q

The same result.

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

* Re: Image file name extension not recognized
  2007-02-03  2:14       ` Vinicius Jose Latorre
@ 2007-02-03  2:35         ` Vinicius Jose Latorre
  2007-02-03  2:36           ` Juanma Barranquero
  0 siblings, 1 reply; 13+ messages in thread
From: Vinicius Jose Latorre @ 2007-02-03  2:35 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

Vinicius Jose Latorre wrote:
> Chong Yidong wrote:
>> Vinicius Jose Latorre <viniciusjl@ig.com.br> writes:
>>
>>> The image-type-header-regexps variable has the value:
>>>
>>>  '(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm)
>>>    ("\\`P[1-6]" . pbm)
>>>    ("\\`GIF8" . gif)
>>>    ("\\`\211PNG\r\n" . png)
>>>    ("\\`[\t\n\r ]*#define" . xbm)
>>>    ("\\`\\(MM\0\\*\\|II\\*\0\\)" . tiff)
>>>    ("\\`[\t\n\r ]*%!PS" . postscript)
>>>    ("\\`\xff\xd8" . (image-jpeg-p . jpeg)))
>>>
>>> Where image-jpeg-p is a function.
>>>
>>> I just type  M-x debug-on-entry RET image-jpeg-p RET
>>>
>>> Then tried to open the file again and image-jpeg-p is not called.
>>
>> I cannot reproduce this.  I also have files saved with extension .JPG,
>> and image-jpeg-p does get called.  Can you try rebuilding Emacs from
>> the latest CVS sources and trying with "emacs -Q"?
>
> I've just downloaded via cvs the latest Emacs 22 version and rebuild it.
>
> emacs -Q
>
> The same result.

I've just noticed the echo area and now has the following message:


    Type C-c C-c to view as an image.

Typing C-c C-c, the image is ok.

The behavior above is the same if the image file has .jpg or .JPG extension.

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

* Re: Image file name extension not recognized
  2007-02-03  2:35         ` Vinicius Jose Latorre
@ 2007-02-03  2:36           ` Juanma Barranquero
  0 siblings, 0 replies; 13+ messages in thread
From: Juanma Barranquero @ 2007-02-03  2:36 UTC (permalink / raw)
  To: Vinicius Jose Latorre; +Cc: Chong Yidong, emacs-devel

On 2/3/07, Vinicius Jose Latorre <viniciusjl@ig.com.br> wrote:

>     Type C-c C-c to view as an image.
>
> Typing C-c C-c, the image is ok.
>
> The behavior above is the same if the image file has .jpg or .JPG extension.

That's the correct behavior.

                    /L/e/k/t/u

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

end of thread, other threads:[~2007-02-03  2:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-03  0:49 Image file name extension not recognized Vinicius Jose Latorre
2007-02-03  1:03 ` Chong Yidong
2007-02-03  1:42   ` Vinicius Jose Latorre
2007-02-03  1:46     ` Chong Yidong
2007-02-03  2:14       ` Vinicius Jose Latorre
2007-02-03  2:35         ` Vinicius Jose Latorre
2007-02-03  2:36           ` Juanma Barranquero
2007-02-03  1:49     ` Vinicius Jose Latorre
2007-02-03  1:06 ` Juanma Barranquero
2007-02-03  1:18   ` Vinicius Jose Latorre
2007-02-03  1:43     ` Chong Yidong
2007-02-03  1:51       ` Vinicius Jose Latorre
2007-02-03  1:59         ` Juanma Barranquero

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