如何在 Palm WebOS 中使用 javascript 将图像转换为字节(如 .Net 中的字节数组)

发布于 2024-08-14 17:36:29 字数 179 浏览 3 评论 0原文

在 Palm WebOs 中,我需要将图像转换为字节(如 .Net 中的字节数组),以将其作为参数传递给 Web 服务,在 Web 服务中我可以将此字节数据转换回图像并保存在服务器上。 请帮助我将图像转换为字符串变量或任何其他格式,以便在 palm webos 中使用 javascript 或 jquery 将其发送到 Web 服务。 谢谢,

In Palm WebOs I need to convert an image into bytes (like byte array in .Net) to pass it as a parameter to a web service, where I can convert back this bytes data to image and save on server.
Please help me to convert image into string variable or any other format to send it to the web service using javascript or jquery in palm webos.
Thanks,

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

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

发布评论

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

评论(1

枕梦 2024-08-21 17:36:29

如果 javascript 引擎支持 canvas 元素,您可以尝试使用 canvas 元素和 getImageData 从图像中获取像素数据。然后,根据图像的类型,您可以创建该图像的二进制表示形式。

以下是有关 canvas 元素和 getImagedata api 的信息:
http://www.whatwg.org /specs/web-apps/current-work/#dom-context-2d-getimagedata

If javascript engine supports canvas elements you can try to use canvas element and getImageData to fetch the pixel data from your image. Then, depending on type of the image you could create the binary representation of this image.

Here is info about canvas element and getImagedata api:
http://www.whatwg.org/specs/web-apps/current-work/#dom-context-2d-getimagedata

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