0

In Xcode, there is option to open a JPG file as hex. What is this actually showing?

enter image description here

On opening, we see something like this.enter image description here

What is the data that is available on the left side and what is on the right side?

In iOS, how can we read the data which is on the right side starting with ˇÿˇ·NÿExifII*?

iOS
  • 3,526
  • 3
  • 37
  • 82

3 Answers3

0

The hex view is showing the bytes of the file. The left side shows the byte offset down the left column and the hex value for each byte in the grid. The right side is simply the character for each byte. A little bullet is shown for non-printable characters.

Use the Data class to load the file into memory. Then you can do whatever you need with the data.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
0

It's actually showing you (in the middle pane) each byte in the file displayed in hexadecimal. In the right pane, you see the ASCII equivalent (where available) of each hexadecimal byte. Sounds like what you really want is to get the EXIF data, a question which is answered here: How to get Exif data from downloaded image

Community
  • 1
  • 1
Owen Hartnett
  • 5,925
  • 2
  • 19
  • 35
0

The hex editor is showing the raw bytes in the file in hexadecimal bytes.

(Personally, I didn't realize Xcode had an Hex viewer, so thanks!)

The data column on the right is attempting to render the binary into byte length ascii where it can. Control codes and the like will render as periods. The use of this is designed for searching for strings or text in a binary file.

The data itself is (for example as a JPEG file) following the JPEG data file format. You can see more info on that on the Wikipedia JPEG page.

In general, one shouldn't need to "read" a jpeg file manually. There are several APIs to reading in a graphic file to have it ready to use easily. In general most graphic entities should live in the .xcassets areas now to allow better resolution scaling for multiple devices.

Dru Freeman
  • 1,766
  • 3
  • 19
  • 41