0

Is there any chance that something like what I showed below, represents an image? I am using an application which performs an image processing task. In the results, I have something like this:

{"annotation":{"filename":"damage_۲۰۲۲۰۸۱۷۱۴۳۴۴۰۸۸۲.jpg","deviceID":"352099","smartphoneID":"anonymous","timestamp":"۲۰۲۲۰۸۱۷۱۴۳۴۴۰","location":{"lat":0,"lon":0},"size":{"depth":3,"height":300,"width":300},"object":[{"bndbox":{"xmax":0,"xmin":215.03150939941406,"ymax":295.1994934082031,"ymin":24.333948135375977},"confidence":0.7488732933998108,"name":"D20"}],"***image***":"\/9j\/4AAQSkZJRgABAQAAAQABAAD\/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB\nAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH\/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEB\nAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH\/wAARCAEsASwDASIA\nAhEBAxEB\/8QAHgAAAgICAwEBAAAAAAAAAAAABAUDBgIHAAEKCQj\/xAA0EAACAwABBAIABQMEAgIC\nAwADBAECBQYREhMUFSEAByIjMQgWMgkkJUFCUTNSF0M0YpH\/xAAbAQADAQEBAQEAAAAAAAAAAAAB\nAgMABAUGB\/\/EADsRAQACAgEDAwIEBAUCBAcAAAERIQIxQQASUSJhcQOBBDJCkQVSobEGE2LB8NHh\nFHKC8RUWIyRDosL\/2gAMAwEAAhEDEQA\/APLgyp1m3WszNo\/X0rN4n67omZ6\/Uze\/SLVmYtaJ+p\/T\nMomM+Zj6jtj\/AD6dsTH6Z+vrr1iI7v8ALums9I\/iZiY3Hp4jee4znuKMpaCDJlHUmhEWdRcVLITK\ntANFSrtBOKwyBvSpAkr2Xr31+64bK7ev8za310mKd1KzWvWvWO2vWOn+XbNqz2zMRMW7vsj6eOQI\n8ECMChDLrQzxM9eTmLzDiSz3VQ7mS62Xua61PdK8xbpS33H3\/M9a9Ijr9T06RPSYiJr3fprStvr8\nLj51oieg+kdIjr0npM2+63mOsdfqvW0TFq1mOkzMRMW2kTLmJmfHWK1jtmO+0TPdEx0mswSK2jrM\n2n6rM9fuK1mPwFbMn9UzTpMdes9e6bREDraazERaax9R1+4mO2I+4+j\/AJYcAQcO64mb2Ksf16no\ngYkLLmziVZ+ar261aXOvHdE1npE2iKxEVmJ\/j+J6xXs6T0iJi89J\/wApm1fwtNn2mKdKRXr1jpEX\nrEV6zH\/cWt1iJ+7RMzaOlfqKxH42mXLrPfFazSYrNbfcW7

and it goes on. I was wondering if the data after the image is convertible to the source image, on which the process has been applied. If it is, how can I do that? and any information on this format is appreciated.

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
Sh K
  • 29
  • 4

1 Answers1

0

Yes, it contains a base64-encoded JPEG image, that starts after the word image where it goes /9j....

See here to recognise it and here to decode it.


So, to convert it, you'd need to delete, up to but not including the /9j after "image" so it looks like this:

/9j....

and save as YOURFILE.TXT

Then you can convert to a JPEG with:

base64 --decode < YOURFILE.TXT > image.jpg

Or, if you don't have base64 app, you can use openssl like this:

openssl enc -base64 -d < YOURFILE.TXT > image.jpg

Or, if you have Python:

python3 -m base64 -d < YOURFILE.TXT > image.jpg
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • I do apologize for the late reply. your solution did work well, however, there were some extra "/" and "\n" in my file which I had to replace with None, before converting. I appreciate it. your response shed a light to the problem as I had no idea what the format is named. Thanks. – Sh K Oct 21 '22 at 21:07