Reading JPEG images in Erlang

Zvi <>
Tue Aug 3 18:03:36 CEST 2010



On Aug 3, 5:38 pm, Bob Ippolito <> wrote:
> On Tue, Aug 3, 2010 at 10:59 PM, Zvi <> wrote:
> > Hi,
>
> > I trying to parse JPEG file in Erlang. I tried jungerl erl_img
> > library, it seems to be working for other image formats, but not for
> > JPEG.
> > I prefer native Erlang code, but if not available, I would use binding
> > to some C library.
> > Any pointers?
>
> Try using a different one, some of the versions of erl_img out there e
> just broken. I think this is the branch we use internally:http://github.com/emad/erl_img
>
> -bob

This is the one I using.
The problem is, unlike for other file formats, like PNG or GIF, it
doesn't load pixels.
For example:

1> erl_img:load("/home/me/some.jpg").
{ok,{erl_image,image_jpeg,undefined,
               "/home/me/some.jpg",undefined,undefined,
               undefined,undefined,[],undefined,200,200,8,3,1,[],
               upper_left,undefined,[]}}

Compare it to PNG:

2> erl_img:load("/home/me/some.png").
{ok,{erl_image,image_png,undefined,
               "/home/me/some.png",undefined,undefined,
               undefined,undefined,[],r8g8b8a8,200,200,8,3,1,
               [{'Physical',{5906,5906,meter}},
                {'ColorType',6},
                {'Compression',0},
                {'Filter',0},
                {'Interlace',0}],
               left_to_right,undefined,
               [{erl_pixmap,0,0,200,200,undefined,r8g8b8a8,...}]}}


More information about the erlang-questions mailing list