{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Open this file in xxd a hex editor by executing

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ng red for black, a 24 ­bit BMP would store this bitmap as follows, where 0000ff signifies red and ffffff signifies white; we’ve highlighted in red all instances of 0000ff. ffffff ffffff 0000ff 0000ff 0000ff 0000ff ffffff ffffff ffffff 0000ff ffffff ffffff ffffff ffffff 0000ff ffffff 0000ff ffffff 0000ff ffffff 0000ff ffffff ffffff 0000ff 0000ff ffffff ffffff ffffff ffffff 0000ff ffffff 0000ff 0000ff ffffff ffffff ffffff ffffff 0000ff ffffff 0000ff 0000ff ffffff 0000ff ffffff 0000ff ffffff ffffff 0000ff ffffff 0000ff ffffff ffffff ffffff ffffff 0000ff ffffff ffffff ffffff 0000ff 0000ff 0000ff 0000ff ffffff ffffff Because we’ve presented these bits from left to right, top to bottom, in 8 columns, you can actually see the red smiley if you take a step back. To be clear, recall that a hexadecimal digit represents 4 bits. Accordingly, ffffff in hexadecimal actually signifies 111111111111111111111111 in binary. Okay, stop! Don’t proceed further until you’re sure you understand why 0000ff represents a red pixel in a 24 ­bit BMP file. Okay, let’s transition from theory to practice. Navigate your way to ~/pset5/bmp/. In that directory is a file called smiley.bmp. If you feel like SFTPing that file to your desktop and double ­ clicking it, you’ll see that it resembles the below, albeit much smaller (since it’s only 8 pixels by 8 pixels). Open this file in xxd, a “hex editor,” by executing the command below. xxd -c 24 -g 3 -s 54 smiley.bmp 8 Some BMPs also store the entire bitmap backwards, with an image’s top row at the end of the BMP file. But we’ve stored this problem set’s BMPs as described herein, with each bitmap’s top row first and bottom row last. 5 < 16 This is CS50. Harvard College Fall 2010 You should see the below; we’ve again highlighted in red all instances of 0000ff. 0000036: 000004e: 0000066: 000007e: 0000096: 00000ae: 00000c6: 00000de: ffffff ffffff 0000ff 0000ff 0000ff 0000ff ffffff ffffff ffffff 0000ff ffffff ffffff ffffff ffffff 0000ff ffffff 0000ff ffffff 0000ff ffffff 0000ff ffffff ffffff 0000ff 0000ff ffffff ffffff ffffff ffffff 0000ff ffffff 0000ff 0000ff ffffff ffffff ffffff ffffff 0000ff ffffff 0000ff 0000ff ffffff 0000ff ffffff 0000ff ffffff ffffff 0000ff ffffff 0000ff ffffff ffffff ffffff ffffff 0000ff ffffff ffffff ffffff 0000ff 0000ff 0000ff 0000ff ffffff ffffff ........................ ........................ ........................ ........................ ........................ ........................ ........................ ........................ In the leftmost column above are addresses within the file...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern