Algorithms :: Imaging :: hexadecimal question |
|||
| By: PHP newbee |
Date: 13/06/2003 01:38:00 |
Points: 50 | Status: Answered Quality : Excellent |
|
I am looking at a bmp file in hex and I am reading through the header information, I am specifically looking at the bytes that contain the size of the file in width and height. Byets 19 through 22 contain the images width, and bytes 23 through 26 contain the images height. I am eventually going to write an application that will take an image and resize it, however to wrap my head around what I need to do, I am looking through the file formats. I am a little confused on one part. I am looking at an extended ascii chart in order to correlate the values from hex. When the image size is less than 255 by 255, the hex values exactly match, meaning if the image is 100 by 130 pixels, in the slot 19 through 22 I see the following hex information: 64 00 00 00 and for the slot 23 through 26 I see the following hex: 82 00 00 00: These numbers break down in decimal format correctly to 100 by 130. Meaning 64 is hex for dec 100 and 82 is hex for dec 130 Here is the part I am confused on, if the image is lets say 307 by 399 pixels in size: Hex is shown as: 31 01 00 00 for the width and 8F 01 00 00 these numbers in DEC come out to 49 01 00 00 and 143 01 00 00, these numbers do not even come close to matching up to 307 and 399, can anyone explain this for me. Is there something I need to do to the numbers I get in decimal in order to correctly figure out the size of the image? Any help is appreciated! Eifson |
|||
| By: PHP newbee | Date: 13/06/2003 01:51:00 | Type : Answer |
|
http://www.daubnet.com/formats/BMP.html 31 01 00 00 = (3*16+1)+(1*256)=305 8F 01 00 00 = (8*16+15)+(1*256)=399 Plus obviously as you move right along the hex number, the base 16 order increases. I think it was 305 x 399? Hope that helps:) |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








