在 Flex 3 中截取屏幕截图的最快方法是什么?
在 Flex 中获取屏幕截图的最快方法是什么?我目前正在使用:(我目前将其编码为 Base64 以上传到网络服务器,但这不一定是必需的。我想要的只是一个出现在服务器上的图像文件)。
ImageSnapshot.defaultEncoder = JPEGEncoder;
var imageSnap:ImageSnapshot = ImageSnapshot.captureImage(<< flex component >>);
var screenshotData:String = ImageSnapshot.encodeImageAsBase64(imageSnap);
目前,它在实际捕获图像时使整个应用程序停留了近一秒钟。 Base64 编码基本上是瞬时发生的。
What's the fastest way to get a screen capture in flex? I am currently using: (I currently encode it to Base64 for upload to a webserver, but this is not necessarily required. All I want is an image file to appear on the server).
ImageSnapshot.defaultEncoder = JPEGEncoder;
var imageSnap:ImageSnapshot = ImageSnapshot.captureImage(<< flex component >>);
var screenshotData:String = ImageSnapshot.encodeImageAsBase64(imageSnap);
It currently holds up the entire application for almost a second as it actually captures the image. The Base64 encoding happens essentially instantaneously.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查看下面的 URL,它是一个开源 JPEG 编码器,比 corelibs 中的编码器快 4 倍以上。
http://www.bytearray.org/?p=775
Check out the fllowing URL, it is an open source JPEG encoder which is over 4 times faster than the one in corelibs.
http://www.bytearray.org/?p=775
看看这个问题的答案:
我使用过的 组件的缩略图一个非常相似的函数,而且速度非常快,所以希望你这样做不会有任何问题。
Take a look at the answer to this: Thumbnails of components
I've used a very similar function and it was pretty fast, so hopefully you'll have no problem doing it that way.
不幸的是,开源 JPEG 编码器并不比 mx.codecs 快。然而,PNG 编码器的构建速度大约是 JPEG 编码器的 6 倍。这解决了我目前遇到的问题,即压缩速度太慢。
CookieOfFortune 的“组件缩略图”答案解决了另一个问题,即与压缩分开拍摄快照(快照对我来说大约需要 5 毫秒,压缩现在小于 500 毫秒)。
The open-source JPEG encoder is not any faster than the mx.codecs one, unfortunately. However, the build in PNG encoder is about 6x as fast as the JPEG encoder. This solves the problem that I was currently having, i.e. too slow compression.
The "thumbnails of components" answer from CookieOfFortune solves another problem, that of taking the snapshot separately from compression, (snapshotting takes ~5ms for me, compression, now, <500ms).