Valhalla Legends Forums Archive | General Programming | jpg header/structure

AuthorMessageTime
dlStevens
Alright, I've googled and googled and found header information all that seems to be relatively the same, so I think it's correct info, however either my jpg is screwed up (doubt it) or I just don't get this (probably).

[code]
  offset            size description
    0                   2 JPEG SOI marker (FFD8 hex)
    2                   2 image width in pixels
    4                  2 image height in pixels
    6                   1 number of components (1 = grayscale, 3 = RGB)
    7              1 horizontal/vertical sampling factors for component 1
    8                   1 sampling factors for component 2 (if RGB)
    9                   1 sampling factors for component 3 (if RGB)]
[/code]
[code]
Byte 1 2 3 4 5 6 7 8 9 10 11
Hex FF D8 FF E0 Skip Skip 4A 46 49 46 00
Char ÿ Ø ÿ à Skip Skip J F I F
[/code]

http://afruj.wordpress.com/2008/08/01/image-file-header-formats/ (little bit more information, I didn't feel the need to copy)

Anyway, so I'm looking at my jpg..
[code]
255 216  <--- So I see the SOI marker.
255 224 0 16 74 70 73 70 0 <--- So I see all of this stuff it says above, however I don't get where to locate my width, height..
1 2 1 0 96 0 96 0 0 255 225 23 176 69 120 105 102 0 0 77 77 0 42 0 0 0 8 0 7 1 18 0 3 0 0 0 1 0 1 0 0 1 26 0 5 0 0 0 1 0 0 0 98 1 27 0 5 0 0 0 1 0 0 0 106 1 40 0 3 0 0 0 1 0 2 0 0 1 49 0 2 0 0 0 28 0 0 0 114 1 50 0 2 0 0 0 20 0 0 0 142 135 105 0 4 0 0 0 1 0 0 0 164 0 0 0 208 0 14 166 0 0 0 39 16 0 14 166 0 0 0 39 16 65 100 111 98 101 32 80 104 111 116 111 115 104 111 112 32 67 83 51 32 87 105 110 100 111 119 115 0 50 48 48 56 58 48 56 58 50 55 32 50 49 58 52 52 58 49 57 0 0 0 0 3 160 1 0 3 0 0 0 1
[/code]

I'm really new to all of this binary reading stuff, so bare with me, I'd appreciate any help that anyone has on JPG/JPEG structure.
August 28, 2008, 4:23 AM
BreW
[quote author=Dale link=topic=17619.msg179527#msg179527 date=1219897428]
[code]
   offset             size description
     0                   2 JPEG SOI marker (FFD8 hex)
     2                   2 image width in pixels
     4                    2 image height in pixels
     6                   1 number of components (1 = grayscale, 3 = RGB)
     7              1 horizontal/vertical sampling factors for component 1
     8                   1 sampling factors for component 2 (if RGB)
     9                   1 sampling factors for component 3 (if RGB)]
[/code]
[code]
Byte 1 2 3 4 5 6 7 8 9 10 11
Hex FF D8 FF E0 Skip Skip 4A 46 49 46 00
Char ÿ Ø ÿ à Skip Skip J F I F
[/code]

http://afruj.wordpress.com/2008/08/01/image-file-header-formats/ (little bit more information, I didn't feel the need to copy)

Anyway, so I'm looking at my jpg..
[code]
255 216  <--- So I see the SOI marker.
255 224 0 16 74 70 73 70 0 <--- So I see all of this stuff it says above, however I don't get where to locate my width, height..
1 2 1 0 96 0 96 0 0 255 225 23 176 69 120 105 102 0 0 77 77 0 42 0 0 0 8 0 7 1 18 0 3 0 0 0 1 0 1 0 0 1 26 0 5 0 0 0 1 0 0 0 98 1 27 0 5 0 0 0 1 0 0 0 106 1 40 0 3 0 0 0 1 0 2 0 0 1 49 0 2 0 0 0 28 0 0 0 114 1 50 0 2 0 0 0 20 0 0 0 142 135 105 0 4 0 0 0 1 0 0 0 164 0 0 0 208 0 14 166 0 0 0 39 16 0 14 166 0 0 0 39 16 65 100 111 98 101 32 80 104 111 116 111 115 104 111 112 32 67 83 51 32 87 105 110 100 111 119 115 0 50 48 48 56 58 48 56 58 50 55 32 50 49 58 52 52 58 49 57 0 0 0 0 3 160 1 0 3 0 0 0 1
[/code]

I'm really new to all of this binary reading stuff, so bare with me, I'd appreciate any help that anyone has on JPG/JPEG structure.
[/quote]
K. first of all why do you have a decimal dump when a hex dump would be much easier to read/understand?

I don't really get what's so hard to understand about that. Your picture is 513x1 apparently, just as the documentation said, the picture dimentions are the first two WORDs after the actual header header. What might've been throwing you off is that the documentation is wrong about the offsets because it fails to take the other 9 bytes into account.
August 28, 2008, 2:14 PM
dlStevens
[quote author=brew link=topic=17619.msg179533#msg179533 date=1219932883]
[quote author=Dale link=topic=17619.msg179527#msg179527 date=1219897428]
[code]
   offset             size description
     0                   2 JPEG SOI marker (FFD8 hex)
     2                   2 image width in pixels
     4                    2 image height in pixels
     6                   1 number of components (1 = grayscale, 3 = RGB)
     7              1 horizontal/vertical sampling factors for component 1
     8                   1 sampling factors for component 2 (if RGB)
     9                   1 sampling factors for component 3 (if RGB)]
[/code]
[code]
Byte 1 2 3 4 5 6 7 8 9 10 11
Hex FF D8 FF E0 Skip Skip 4A 46 49 46 00
Char ÿ Ø ÿ à Skip Skip J F I F
[/code]

http://afruj.wordpress.com/2008/08/01/image-file-header-formats/ (little bit more information, I didn't feel the need to copy)

Anyway, so I'm looking at my jpg..
[code]
255 216  <--- So I see the SOI marker.
255 224 0 16 74 70 73 70 0 <--- So I see all of this stuff it says above, however I don't get where to locate my width, height..
1 2 1 0 96 0 96 0 0 255 225 23 176 69 120 105 102 0 0 77 77 0 42 0 0 0 8 0 7 1 18 0 3 0 0 0 1 0 1 0 0 1 26 0 5 0 0 0 1 0 0 0 98 1 27 0 5 0 0 0 1 0 0 0 106 1 40 0 3 0 0 0 1 0 2 0 0 1 49 0 2 0 0 0 28 0 0 0 114 1 50 0 2 0 0 0 20 0 0 0 142 135 105 0 4 0 0 0 1 0 0 0 164 0 0 0 208 0 14 166 0 0 0 39 16 0 14 166 0 0 0 39 16 65 100 111 98 101 32 80 104 111 116 111 115 104 111 112 32 67 83 51 32 87 105 110 100 111 119 115 0 50 48 48 56 58 48 56 58 50 55 32 50 49 58 52 52 58 49 57 0 0 0 0 3 160 1 0 3 0 0 0 1
[/code]

I'm really new to all of this binary reading stuff, so bare with me, I'd appreciate any help that anyone has on JPG/JPEG structure.
[/quote]
K. first of all why do you have a decimal dump when a hex dump would be much easier to read/understand?

I don't really get what's so hard to understand about that. Your picture is 513x1 apparently, just as the documentation said, the picture dimentions are the first two WORDs after the actual header header. What might've been throwing you off is that the documentation is wrong about the offsets because it fails to take the other 9 bytes into account.
[/quote]

My picture however isn't 513x1 it's 600x535..
August 28, 2008, 2:36 PM
BreW
Ah yes, it seems your documentation failed to note the use of different headers for jfif and is sucky all around. I would try looking at something official.
August 28, 2008, 3:51 PM

Search