Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 680671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:23:54+00:00 2026-05-14T01:23:54+00:00

I have a lot of jpeg files with varying image size. For instance, here

  • 0

I have a lot of jpeg files with varying image size. For instance, here is the first 640 bytes as given by hexdump of an image of size 256*384(pixels):

0000000: ffd8 ffe0 0010 4a46 4946 0001 0101 0048  ......JFIF.....H
0000010: 0048 0000 ffdb 0043 0003 0202 0302 0203  .H.....C........
0000020: 0303 0304 0303 0405 0805 0504 0405 0a07  ................
0000030: 0706 080c 0a0c 0c0b 0a0b 0b0d 0e12 100d  ................

I guess the size information mus be within these lines. But am unable to see which bytes give the sizes correctly. Can anyone help me find the fields that contains the size information?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:23:55+00:00Added an answer on May 14, 2026 at 1:23 am

    According to the Syntax and structure section of the JPEG page on wikipedia, the width and height of the image don’t seem to be stored in the image itself — or, at least, not in a way that’s quite easy to find.

    Still, quoting from JPEG image compression FAQ, part 1/2 :

    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/.

    (Ergh, that link seems broken…)

    Here’s a portion of C code that could help you, though : Decoding the width and height of a JPEG (JFIF) file

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some troubles with saving a image from memorystream. Here is my code:
I have successfully been using CGImageSource to read an image in (mostly JPEG) and
I have a lot of jpeg images which I want to optimize for web
We have lot of configuration files used in our application. Atleast 100 different xml
(I have read a lot of similar questions, but bear with me here) I
I have some image-files stored into one file (some kind of archive). That file
I have lot of products with custom options, now I have requirement to update
I have lot of code in my Tornado app which looks like this: @tornado.web.asynchronous
We have lot of object with this kind of design : Interface and several
I have a requirement to use date picker in my applicaiton. I have lot

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.