Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 23:50 Go to next message
Jonah Bron is currently offline Jonah Bron
Messages: 32
Registered: October 2010
Location: California
Member
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


Premature developer
Re: How to Crop/Trim Image/ImageData [message #637815 is a reply to message #637813] Tue, 09 November 2010 00:45 Go to previous messageGo to next message
Jonah Bron is currently offline Jonah Bron
Messages: 32
Registered: October 2010
Location: California
Member
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();


Premature developer
Re: How to Crop/Trim Image/ImageData [message #648502 is a reply to message #637813] Thu, 13 January 2011 09:41 Go to previous message
inzamam  is currently offline inzamam
Messages: 1
Registered: January 2011
Junior Member
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: Wed Oct 22 23:06:17 GMT 2014

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

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