[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Creating thumbnails from Image.

En/na Neelesh Thakur ha escrit:
Hi,

I want to create thumbnails from Images [.gif or .jpeg]. Is there any way to do it in eclipse or Is there any plugin to do that in eclipse.

Any pointers will be very helpful..
thanks
Neelesh Thakur


Try using the "Image IO" library from the standard JDK. I suggest installing "JAI Imaging IO Tools" so you will get some readers capable of reading embedded thumbnails in JPEG images.


If there is no embedded thumbnail in your image files, then just load the image with SWT:

Image img = new Image(display,filename);

and then resize it, with something like:

Image thumb = new Image(display,x,y);
GC gc = thumb.getGC();
gc.drawImage(img,0,0,sizex,sizey,0,0,x,y);

(this pseudo-code is surely not 100% correct, consider it just a hint).

- Enric