Save the content of the view in an image file on disk [message #233955] |
Mon, 07 May 2007 09:36  |
Eclipse User |
|
|
|
Originally posted by: malnatij.lu.unisi.ch
I'm saving the content of the view on disk using:
image = new Image(device, r.width, r.height);
gc = new GC(image);
g = new SWTGraphics(gc);
g.translate(r.x * -1, r.y * -1);
figure.paint(g);
ImageLoader imageLoader = new ImageLoader();
imageLoader.data = new ImageData[] {image.getImageData()};
imageLoader.save(result, format);
and saving to disk the resulting byte array..
the problem is that the format might be SWT.IMAGE_JPEG (and it works, but the quality is low), SWT.IMAGE_GIF (Unsupported color depth exception!!), SWT.IMAGE_PNG(Unsupported or unrecognized format), SWT.IMAGE_BMP (it works but all the colors are yellow-like).
How can I increase the quality of the JPG file? How can I use BMP without having jellow colors all around? What's wrong with GIF and PNG?
|
|
|
|
|
Re: Save the content of the view in an image file on disk [message #238318 is a reply to message #233955] |
Wed, 05 September 2007 07:10  |
Eclipse User |
|
|
|
Hey Jappo.
I have had the same problem with ImageLoader.save() using SWT.IMAGE_BMP format.
For me, on Windows, the image comes out fine.
But on Linux (red-hat and suse) using the same code I find that the red and blue values of each pixel is swapped (a full-red square becomes blue, and a full blue square becomes red).
Did you have any luck finding out what your problem was? Would like to here if you did, maybe it would help with my problem.
Cheers
Sid
|
|
|
Powered by
FUDForum. Page generated in 0.04203 seconds