Question

When I open a ".jpg" picture file with notepad and edit it, after saving the file doesn't open. As an error, it says that file is damaged. And even when I delete some symbol and rewrite it, in the same place, in the same way, and save changes after that, it still won't open. Why?

Was it helpful?

Solution

JPG is a binary format, by that we mean that it represents a series of numbers. Notepad is for editing text files, in a text file those numbers refer to letters (using the ASCII table). Editing a binary file in a text editor is likely to cause corruption as the text editor may not be able to represent all of the file properly (it's not actually text) and may modify it to force it to be text before storing it.

In particular, many numbers are used as control codes (eg. the new line character). As JPG is a binary format those control codes have no meaning and will be dispersed throughout the file creating more havok than just displaying gobbledegook.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top