Hexadecimal-> file (jpg) / how to convert?

Hexadecimal-> file (jpg)
Link: https://tomeko.net/online_tools/hex_to_file.php?lang=en

Good morning. I want to convert the HEX value into a jpg file,

Pimage img;

I want to put a jpg file in the img variable and display it on the screen.

Does anyone know how to convert?

FILE LINK : https://drive.google.com/drive/folders/1rhQzGZZEryEzlxKUwgKbeSdSVcbO1lH5

  1. jpg file
  2. jpg hex file
1 Like

we had the question already the other way,
have a picture and store its pix / color info in HEX text to a file.

so if you have a HEX text file and want read that in processing
and construct a picture from it there is the need to know
what the values ( and the file structure ) mean?

-a-

FFD8FFFE0024462679BB000000000000, 
000000000000000000F0004001080032, 

the file has a structure with lines and ,
possibly that means nothing and can be ignored while reading?

-b- 6 char could be 3 byte numbers lets say of R G B value for one pix?

FFD8FF

as ASCII text to bytes [255] [216] [255]

pix[0] = color( 255,216,255);

-c- but to make a picture from that would still need a additional information
what is the width of the picture in pix? like where the next line starts.

-d- you posted a picture with the dim. 320 * 240
-d1- is that the original you used to make the HEX text file from? and how you did that ?
-d2- is that the dim info you want use to reconstruct it?

-e- you see, if that is a coding / decoding question
that even without any encryption used,
it is already difficult without add information.

@kll

Thank you for your interest.

Answer 1: Picture width: 320x240
Answer 2: I received data from mcu through a serial camera.
Answer 3: I know it is in jpg codec.

processing can not decode jpg codec easily,
so do the same as the

tomeko.net/online_tools/hex_to_file.php

converter does,

  • ignoring ‘,’ and lines
  • take 2 char make one byte

and try to save it to a jpg file in binary.
https://processing.org/reference/saveBytes_.html
and reload that as a image

2 Likes

@kll

thank you. Thanks to you.
thank you very much.

tt

2 Likes

@kll

Thanks to you for finishing the project.

VIDEO :
https://serviceapi.nmv.naver.com/flash/convertIframeTag.nhn?vid=895ABC927F98438CEB16AED3A3ADBF9AEA7F&outKey=V1243470d17493faa3fde56e9be4b1ee33e3d1c9f79a830dc51b956e9be4b1ee33e3d&width=544&height=306

PICTURE :

URL SITE :
https://blog.naver.com/my_k_s_j
https://blog.naver.com/happy32861

2 Likes