Re: Where to find examples of malformed JPEG files



> I guess you could create it yourself, maybe by trying to store a
> JPEG to a floppy disk and yanking it during the save.

That's a bit hit-or-miss. You can easily truncate a file by using
wc(1) if you're on a Unix system:

wc -c500 foo.jpg > broken.jpg

or by using Perl just about anywhere.

perl -e 'truncate "foo.jpg", 500'

For that matter, a GIF file makes a great corrupted JPEG file. Or just
about any other kind of file. It depends on what kind of corruption
you're looking for.

Try opening a JPEG file in a text editor. Saving it back out again
might be enough to corrupt it, depending on your OS and your
editor. If not, then just move the cursor a ways down and add or
delete a single character.

Here's another Perl script:

perl -e 'open F, shift; seek F, 500, 0; print F chr 255' foo.jpg

This replaces the 500th byte in the file foo.jpg with the value 255.
Replace 500 and 255 with anything you like to tailor the corruption
to taste.

b

.



Relevant Pages

  • Re: JPEG File Corruption
    ... jpeg saves will be corrupted? ... for 64 bits your bits may become gibberish. ... The AMD 64 bit processors are completely compatible with 32 bit software. ... This is definitely NOT a problem, since I also experienced this corruption before getting the 64 bit processor. ...
    (rec.photo.digital)
  • Re: Newsreader usage in this group
    ... text editor actually to behave like a text editor. ... or words in a data file? ... > I must admit that rendering JPEG images is one thing zap don't do. ... JPEG display code that's completely irrelevant to the purpose ...
    (uk.comp.sys.mac)
  • Re: Decoding Winmail.dat attachments
    ... Rob Kendrick wrote: ... Open the file up in a text editor and ... make an educated guess about its format, ... We knew there was a jpeg inside the winmail so after the online decode ...
    (comp.sys.acorn.apps)
  • Extracting image metadata of multiple files
    ... How can I extract this data for each jpeg? ... Is this exif data is it some proprietary MS format? ... editor... ...
    (comp.lang.php)
  • saving photo from one format to another
    ... While my photos are in JPEG and I open it up on my editor, ... Both icons for the JPEG and the TIFF are the same. ...
    (microsoft.public.windowsxp.photos)