• Welcome to Valhalla Legends Archive.
 

jpg header/structure

Started by Dale, August 27, 2008, 11:23 PM

Previous topic - Next topic

Dale

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


   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)]


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


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

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


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.

brew

Quote from: Dale on August 27, 2008, 11:23 PM

   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)]


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


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

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


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.
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.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Dale

Quote from: brew on August 28, 2008, 09:14 AM
Quote from: Dale on August 27, 2008, 11:23 PM

   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)]


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


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

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


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

My picture however isn't 513x1 it's 600x535..

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.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P