comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Unknown data type
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Unknown data type [message #42120 is a reply to message #42107] Tue, 28 December 2004 19:29 Go to previous messageGo to previous message
ed is currently offline  ed
Messages: 3
Registered: October 2004
Junior Member
Julio, David and others,

The first line of most image formats (at least the few that I've poked
into) contains a code that tells you the format of the image. For
example, a gif file may start off with GIF89, and a jpg file will have
JFIF in the bytes 5-8. If you can figure out these codes in advance
for each type of image you are likely to read, you can write a program
to read the first dozen or so bytes and search for the code, then use
that information to run the appropriate IDL routine (read_gif,
read_jpeg, or whatever).

You might even be able to learn how it's done for the 3 web-based
formats
(gif, jpg & png) by looking at the freely-available source code for
Firefox or Mozilla, since these browsers (and any other competent one)
identify the file type by reading the first several bytes.

Ed Schmahl
University of Maryland
Astronomy Department

David Fanning wrote:
> Julio writes:
>
>> I can read byte or integer images using byte or integer arrays,
like:
>>
>> byte_image=bytarr(samples, rows) or
>> integer_image=intarr(samples, rows)
>>
>> In both cases I must know the data type. But, when I don't know
the
>> data type, how can I do to read the images? Is there some way to
>> verify the file format before reading into an array?
>
> How can you find the New Year's party when you don't
> know the address? It's a problem. :-(
>
> Cheers,
>
> David
>
> P.S. You could do a small "trial read" and see
> if the data "made sense" the way you read it.
> What "makes sense" means is kind of up to you.
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GUI builder limitations?
Next Topic: passing objects between GUI callbacks

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Nov 29 01:33:20 PST 2025

Total time taken to generate the page: 1.60014 seconds