JavaScript、输入流和 DIB?

发布于 2024-07-06 09:08:39 字数 60 浏览 7 评论 0原文

有没有什么有用的方法可以将DIB加载到输入流中并获取它的句柄以及JavaScript(js)中的所有内容?

Is there any useful way to load DIB into inputstream and get a handle to it and all that in JavaScript (js) ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白芷 2024-07-13 09:08:39

假设DIB意味着设备独立位图...

如果DIB位于浏览器的客户端,那么我认为你不能只用浏览器中的JS来做到这一点。 你需要一些java或flash或其他东西,因为浏览器中的javascript无法从文件系统读取内容。

如果 DIB 在服务器上,您可以使用 ajax 请求来获取它。 在回调中,将返回的数据复制到一个对象中,然后您可以在其中根据需要操作数据。

完成图像数据的操作后,您可以使用画布或 img 标签来显示它。

http://developer.mozilla.org/en/Canvas_tutorial/Using_images

我没有我尝试过这个,直到我看到你的问题,但是带有数据 url 的 img 标签非常有趣。 在 IE 中使用 img src 中的数据 url 不起作用,但在 FF 和 Opera 中可以。 IE 没有canvas 标签,但它们确实有类似的东西。 google 的一些聪明人编写了一个 javascript 库,通过将其转换为 IE 可以理解的内容来启用 IE 中的 canvas 标记。

http://code.google.com/p/explorercanvas/

希望这会有所帮助。 如果不是,也许它至少很有趣。

Assuming DIB means Device Independent Bitmap...

If the DIB is on the client side in a browser, then I don't think you can do this with just the JS in the browser. You would need some java or flash or something else, because javascript in the browser has no way to read stuff from the filesystem.

If the DIB is on the server, you can use an ajax request to fetch it. In the callback, copy the returned data into an object where you can then manipulate the data as needed.

Once you are done manipulating the image data, you can use a canvas or an img tag to display it.

http://developer.mozilla.org/en/Canvas_tutorial/Using_images

I hadn't tried this until I saw your question, but an img tag with a data url is pretty interesting. Using the data url in the img src doesn't work in IE, but it does in FF and Opera. IE doesn't have a canvas tag, but they do have something similar. Some smart guys at google wrote a javascript library to enable the canvas tag in IE by translating into something IE understands.

http://code.google.com/p/explorercanvas/

I hope this helps. If not, maybe it is at least interesting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文