To read a JPEG image, it is recommended that you use an appropriate library.
It's not easy just with self-written C ++ code.
There are different options depending on the compiler and operating system.
Unfortunately the information is missing what exactly is needed.
A JPEG reference implementation can be found here:
Reference Sources – JPEG Reference[
^]
On Debian based systems you can install libjpeg and headers:
sudo apt-get install libjpeg-dev
On Windows you can use GDI+ to read File to Bitmap:
Bitmap::FromFile (gdiplusheaders.h) - Win32 apps | Microsoft Docs[
^]