Search code examples
javascriptc++node.jsimage-formats

Any ideas on what type of image formatting this might be?


A program which written in C++ is sending an image to my node.js server, unfortunately I dont have access to the C++ code. My goal is to display this image on my front end, Ive tried doing so by doing a .toString('base64') call on the data but this didnt work. Heres what the data looks like when I write it to file vs when i perform a for loop and do a .toStrng(). Any ideas on what the image format is? enter image description here After performing the following code

for (var i = 0; i < image.length; i++) {
                        wstream.write(image[i].toString());
}

enter image description here


Solution

  • The code on this page can be used to determine the image type:

    http://oroboro.com/image-format-magic-bytes/

    The first few bytes of the file are different between image formats, the formats you're looking for are listed in that page.