emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using libmagic in Emacs?


From: Juri Linkov
Subject: Re: using libmagic in Emacs?
Date: Sun, 23 Aug 2009 02:36:22 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu)

>     >> For instance, in "image.el" there is functionality to look at
>     >> magic numbers in image files.
>
>     image.el doesn't recognize some rare JPEG formats, so libmagic
>     will be useful here.
>
> Extending image.el mightbe a lot easier than other solutions.

The problem is that `image-jpeg-p' in image.el refuses to accept
non-JFIF JPEG image files whereas Emacs can correctly display them
when tests in `image-jpeg-p' are ignored.

Using libmagic means looking only for 2 bytes 0xffd8 (a magic number
of JPEG files) as described by the magic number file:

  0     beshort         0xffd8          JPEG image data

It seems this is enough to determine JPEG files.  But I'm not confident
about removing additional tests from `image-jpeg-p'.  We could keep the
current rules in image.el as a fall-back when libmagic is not available.

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]