× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Retrieving JPG and GIF file data in an AS/400 program
  • From: Rob Dixon <rob.dixon@xxxxxxxxxxx>
  • Date: Tue, 29 Aug 2000 23:31:19 +0100
  • Organization: Erros plc

John

Thank you for sending this


> The following excerpt is from the JPEG-FAQ:
>
> Subject: [22] How can my program extract image dimensions from a JPEG file?
>
> The header of a JPEG file consists of a series of blocks, called "markers".
> The image height and width are stored in a marker of type SOFn (Start Of
> Frame, type N).  To find the SOFn you must skip over the preceding markers;
> you don't have to know what's in the other types of markers, just use their
> length words to skip over them.  The minimum logic needed is perhaps a page
> of C code.  (Some people have recommended just searching for the byte pair
> representing SOFn, without paying attention to the marker block structure.
> This is unsafe because a prior marker might contain the SOFn pattern, either
> by chance or because it contains a JPEG-compressed thumbnail image.  If you
> don't follow the marker structure you will retrieve the thumbnail's size
> instead of the main image size.)  A profusely commented example in C can be
> found in rdjpgcom.c in the IJG distribution (see part 2, item 15).  Perl
> code can be found in wwwis, from http://www.tardis.ed.ac.uk/~ark/wwwis/.
>
> The entire faq (2 parts) can be retrieved from the following FTP location:
>
> ftp://rtfm.mit.edu/pub/usenet-by-hierarchy/news/answers/jpeg-faq/

I have had a look at these links but I am not really any the wiser.  Please
excuse my stupidity but I couldn't understand how to identify the SOFn byte 
pair.
I have looked at a JPEG file using Wordpad but, even though I knew the size of
the image, I could not identify the values in the header.

I would like to do the work in my AS/400 rather than on a PC as part of a 
routine
to load the jpeg file names and image size data into my AS/400 database.  If I
knew how to identify the byte pair, then I imagine that I could do the job.  Do
you know if there woud be any code page issues.

Best wishes

Rob
________________________________________________________

Erros plc

44 (0) 1844 239 339

http://www.erros.co.uk - The AS/400 Neural Database for the Internet

_________________________________________________________


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.