简体   繁体   English

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

[英]Is it possible to display .bin image files on a web page without converting it to jpg/png/gif?

I am able to view the .bin image files using display command in ImageMagick. 我可以使用ImageMagick中的显示命令查看.bin图像文件。

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

I was able to convert it to jpg format and then display on a webpage. 我能够将其转换为jpg格式,然后显示在网页上。 But I need to display the file without converting it to jpg. 但是我需要显示文件而不将其转换为jpg。

Using php exec() , it was possible to display the file when running the php file on terminal but not on apache web server. 使用php exec() ,可以在终端上而不是apache Web服务器上运行php文件时显示该文件。 Is there a way to display the .bin image file on a web page? 有没有办法在网页上显示.bin图像文件? Please help me as I have been trying this for many days... 请帮我,因为我已经尝试了很多天了...

No. 没有。

The gray: protocol will only output an image data blob. gray:协议将仅输出图像数据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. 甚至display要求您至少指定大小+深度,然后才能读取.bin文件。

However, if you can communicate the depth & width to the web browser, you can rebuild the image with Javascript & <canvas> tag. 但是,如果可以将深度和宽度传达给Web浏览器,则可以使用Javascript和<canvas>标记重建图像。 But that would be labor intensive, and the load-time results would be unpleasant for end-users. 但这将是劳动密集型的,并且加载时间结果对于最终用户而言将是令人不快的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM