Imageloader.save to ByteArrayOutputStream is painfully slow
Is there anyway to speed up SWT's imageLoader.save()
-method? I have to compress raw ima开发者_StackOverflow中文版gedata into JPEG. It takes 130 - 250 ms to compress a 1680 x 1050 pixel large image.
imageLoader.save(bos, SWT.IMAGE_JPEG);
.
- Am i missing something?
- Is there another, faster way to compress large byte-Arrays / Images?
Any help would be appreciated
Are you initializing the ByteArrayOutputStream with the default constructor? The default size for the internal buffer is only 1024 bytes, so the object would be constantly adding new buffers each time you exceed its size. You should be able to come up with some basic upper limit on the image size and initialize the BAOS to that. This might reduce some of the wait time you are experiencing.
精彩评论