Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to Crop/Trim Image/ImageData
How to Crop/Trim Image/ImageData [message #637813] Mon, 08 November 2010 18:50 Go to next message
Eclipse UserFriend
Hello, world!

My application requires cropping some thumbnails. I tried searching the internet and this forum, and only came up with this:

http://www.eclipse.org/forums/index.php?t=msg&th=107998# msg_330182

The solution presented requires converting the ImageData to an AWT BufferedImage, which I'm sure is inefficient. Manipulating x, y, width, and height do not appear to have an effect. How does one go about this? GC?

Thanks
Re: How to Crop/Trim Image/ImageData [message #637815 is a reply to message #637813] Mon, 08 November 2010 19:45 Go to previous messageGo to next message
Eclipse UserFriend
Never mind, I got it figured out. GC was the key as I suspected. Here's an example of what I did, for future reference.

// Image image
Image newImage = new Image(null, thumb_width, thumb_height);
GC gc = new GC(newImage);

gc.drawImage(image, crop_left, crop_top, image.width - (crop_right * 2), image.height - (crop_bottom * 2), height, 0, 0, thumb_width, thumb_height);
gc.dispose();
Re: How to Crop/Trim Image/ImageData [message #648502 is a reply to message #637813] Thu, 13 January 2011 04:41 Go to previous message
Eclipse UserFriend
if you want crop any image, than i will suggest you to visit the link below
http://www.raiseitsolutions.com/forum/viewtopic.php?f=4& t=2
if you visit this link, you will know how to crop an image easily
thank you very much. Smile
Previous Topic:drag & drop of url link
Next Topic:Render Problem of AWT loaded TTF file on MacOS
Goto Forum:
  


Current Time: Tue Jul 08 07:21:22 EDT 2025

Powered by FUDForum. Page generated in 0.10556 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top