收到解码的base64图像作为电子邮件的谷歌应用程序引擎 [英] Decoding base64 image received as email on Google App Engine

查看:295
本文介绍了收到解码的base64图像作为电子邮件的谷歌应用程序引擎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要脱code一个base64连接codeD映像收到通过电子邮件在谷歌的App Engine(GAE)。当我提取的MimeMessage的形象,我收到了base64De coderStream对象。我最初认为这种德codeD数据是ARGB格式字节数组,但似乎并没有在这里如此。我验证了这一点通过比较一去codeD字节数组运行ImageIO.read(镜像文件).getRGB()了,他们不匹配。

I want to decode a base64 encoded image received over email on Google App Engine(GAE). When I extract the image from MimeMessage I get a base64DecoderStream object. I initially assumed that this decoded data is byte array in ARGB format, but that doesn't seem to be the case here. I verified this by comparing the decoded byte array with the one got from running "ImageIO.read(ImageFile).getRGB()" and they didn't match.

所以我想知道: -

So I was wondering:-

1)哪些图像格式数据没有我的图像的解码的base64后得到什么?

1) Which image format data did I get after decoding the Image with base64 ?

2)怎样才能在GAE上的实际图像PNG或JPG?

2) How can I get the actual image PNG or JPG on GAE ?

3)最后,有没有办法让GAE ARGB格式收到的邮件的形象?

3) Finally, is there a way to get the received email image in ARGB format on GAE ?

任何帮助是极大AP preciated ...
谢谢

Any help is greatly appreciated... Thanks

推荐答案

中的Base64 EN codeD数据是图像文件本身,而不是解压后的像素数据。它是被附加到消息的实际文件。所以解码Base64编码的数据,在这种特殊情况下后你有一个二进制PNG文件。

The Base64 encoded data is the image file itself, not the unpacked pixel data. It's the actual file that was attached to the message. So after decoding the Base64 data, in this particular case you had a binary PNG file.

要操纵它作为一个形象,你有几种选择:

To manipulate it as an image, you have several options:


  1. 通过德codeD 字节[] 直接 ImagesServiceFactory.makeImage()

  2. 写去codeD 字节[] 到文件并调用 ImagesServiceFactory.makeImageFromFilename()

  3. 店铺去codeD 字节[] 进入数据库作为的Blob ,然后调用 ImagesServiceFactory.makeImageFromBlob()

  1. Pass the decoded byte[] directly to ImagesServiceFactory.makeImage().
  2. Write the decoded byte[] to file and call ImagesServiceFactory.makeImageFromFilename().
  3. Store the decoded byte[] into the database as a Blob and then call ImagesServiceFactory.makeImageFromBlob().

一旦你这样做了,不幸的是它看起来并不像有一个简单的方式来获得使用谷歌的内置的API的ARGB数据。这里讨论可能有助于解决办法:<一href=\"http://stackoverflow.com/questions/4087358/extracting-image-pixel-values-in-google-appengine\">Extracting图像的像素值在谷歌的AppEngine 。

Once you've done that, unfortunately it doesn't look like there's a trivial way to get the ARGB data using Google's built-in API's. The solution discussed here may help: Extracting image pixel values in google appengine.

这篇关于收到解码的base64图像作为电子邮件的谷歌应用程序引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆