是否可以在网页上显示.bin图像文件而无需将其转换为jpg / png / gif?

I am able to view the .bin image files using display command in ImageMagick.

display -size 512x512 -depth 32 -equalize gray:<filename>

I was able to convert it to jpg format and then display on a webpage. But I need to display the file without converting it to jpg.

Using php exec(), it was possible to display the file when running the php file on terminal but not on apache web server. Is there a way to display the .bin image file on a web page? Please help me as I have been trying this for many days...

No.

The gray: protocol will only output an image data blob. There is no image headers, and various important meta-data (like size, depth, & etc) are not communicated/transported.

Even display requires you to, at minimum, specify size + depth before it can read the .bin file.

However, if you can communicate the depth & width to the web browser, you can rebuild the image with Javascript & <canvas> tag. But that would be labor intensive, and the load-time results would be unpleasant for end-users.