-3

So my problem is with one of the Jpeg's I am working with. The things with Jpegs is that if you change even the slightest part of its HEX file, the whole image just gets screwed up. I zeroed out about two lines from the BODY of this JPEG and it blew up by giving me this crazy green layer on half of the image. Other image formats wont really do this. It has something to do with the JPEGS storing references to similar colors as opposed to storing a separate data for every pixel. My question is, is there any way to lessen the effect that occurs as a result of missing even a single line of data from the HEX file? Ideally I would be looking for a program that can make it somewhat visible.

Thanks, Daniyalenter image description here

  • this goes not seem to be a photography related question and would probably be better suited for a graphics site. – ths Dec 2 '14 at 15:05
  • possible duplicate of Is there a way to recover corrupted JPEG files? – mattdm Dec 2 '14 at 15:13
  • 4
    Voting to close as unclear - there's no indication as to what the desired end result of this process is, plus a bunch of assumptions about how JPEG files work ("references to similar colors") which are just wrong (it's a discrete cosine transform). Please edit the question to explain why you're making these arbitrary binary changes to the file, and how this is relevant to photography. – Philip Kendall Dec 2 '14 at 15:36
  • 1
    This question appears to be off-topic because it is about image file manipulation, not photography. – AJ Henderson Dec 2 '14 at 15:41
  • Wasn't this very same image and very same question asked a few months ago? – B Shaw Dec 2 '14 at 21:19
4

If your intention is to modify the JPEG file by changing some bytes inside it, just do the following:

  1. convert JPEG to uncompressed BMP
  2. change the bytes
  3. convert BMP to JPEG
2

You've deliberately vandalised a compressed file, there is no way to recover the data except for you to put back what you've broken.

Image recovery tools are built to work by taking blocks of data and getting them back into the right order; such as when the filesystem is damaged on an SD card or harddisk. They are not designed to correct the kind of damage that has occurred (if it's even possible.)

A good analogy for the compression is a thought experiment - Take driving directions for a mystery tour from google maps. Remove all the waypoint information, road names etc. as we don't need those to steer the car. The remaining instructions you can form into a simplified system (go n Km, turn left/right, take exit #n, repeat the last instruction n times for example). That is your 'compressed' driving directions. Now delete a bunch of directions in the middle before hitting print - that's what you've done and there is no way to fix it.

-1

JPEG is a file format standard for storing images. It is not a HEX file. There is no HEX encoding in a JPEG file. Your question therefore makes not sense and can't be answered.

The way compression is done in the JPEG encoding scheme, there is not necessarily a 1:1 correspondence between a few adjacent bits in the file and a particular location in the image. It doesn't work that way. A small error in a JPEG file can have a large impact on the image. That's the way it works.

Consider your file above corrupt and ditch it. Go back to the source, your backups, or wherever it originally came from.

  • 1
    Hex is a common way to display binary values at the byte level within a file, all files can be displayed and edited using a 'hex editor'. – James Snell Dec 2 '14 at 15:33
  • 1
    @James: Yes, all files can be displayed as HEX and even manipulated that way with a suitable user interface. But that doesn't make it a "HEX file" as the OP was asking about. There are true HEX files, such as the common Intel format HEX file for storing the data for EEPROMs and the like. JPEG uses no such encoding. – Olin Lathrop Dec 2 '14 at 15:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.