>     Out of curiosity, has anyone written any Rebol/Core code that will
> extract the dimensions of JPEG, GIF, and PNG files? I know this is more
> the realm of Rebol/View, but it would be useful for Rebol/Core CGI
> scripts too. 

Hi Eric.

Here is the function returning x and y sizes of gif.

gifsize: func [
  gif [file!]
  /local x y data
][
  ;353x62
  data: read/binary gif
  if none? find to-string ["GIF89a" "GIF87a"] copy/part data 6 [
    make error! "Not a gif file"
  ]
  x: data/7 + (256 * data/8)
  y: data/9 + (256 * data/10)
  return [x y]
]       

I hope this can be useful :-)

Regards,
Jan

Reply via email to