9: Rebuilding an Image Header (10 Points)

What You Need for This Project

Downloading the Image File

Right-click the link below and save the file on your desktop:

badhead2.jpg

Opening the Image File

On your desktop, double-click the badheader.jpg file.

You see an error message, as shown below:

Viewing the File in a Hex Editor

Open the badheader.jpg file in HxD.
If you don't have HxD, download it from: http://mh-nexus.de/en/hxd/
The header looks wrong--it starts with DE AD BE EF, as shown below:

So to fix it, you need to find out what a good JPG header looks like.

You can use online resources like this:


From http://www.garykessler.net/library/file_sigs.html
But a simpler way is to just examine a good JPG.

Examining a Good JPG File

Open Paint.

Draw or scribble something, as shown below:

Click File, Save.

Save the file as a JPG.

Open the file you just created in HxD.

The first few bytes are different--not DE AD BE EF, but FF D8 FF E0 as shown below:

Repairing the Header

In HxD, with "badheader.jpg" open in the left pane, click on the first byte, which now is DE.

Type over it with FF

The changed letters turn red, as shown below:

Continue in the same manner to fix the first four bytes of the file in HxD.

Your file should now look like the image below:

Saving the File

In HxD, click File, Save.

Viewing the Image

On your desktop, double-click the badheader.jpg file.

The image should open correctly now, showing kitten with a message.

Recording Your Success

Use the form below to put your name on the WINNERS PAGE.
Your Name:
Message:

Posted: 5-21-18