Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Convert Image from BMP to GIF
Convert Image from BMP to GIF [message #466989] Fri, 20 January 2006 16:09 Go to next message
Eclipse User
Originally posted by: mowens72.gmail.com

I have an SWT canvas that I can save without any problems to BMP and
Jpeg. Is it possible to save it as a GIF?

Or, does anyone have a code example that will convert an SWT Image to
transparent GIF? Thanks!

Mike O.
Re: Convert Image from BMP to GIF [message #467028 is a reply to message #466989] Mon, 23 January 2006 15:39 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika Irvine
Messages: 1272
Registered: July 2009
Senior Member
The following snippet saves an animated gif - your case will be simpler but
similar:

http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org. eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet194 .java

"Mike Owens" <mowens72@gmail.com> wrote in message
news:dqr1vk$4as$1@utils.eclipse.org...
>I have an SWT canvas that I can save without any problems to BMP and Jpeg.
>Is it possible to save it as a GIF?
>
> Or, does anyone have a code example that will convert an SWT Image to
> transparent GIF? Thanks!
>
> Mike O.
Re: Convert Image from BMP to GIF [message #467161 is a reply to message #467028] Wed, 25 January 2006 21:29 Go to previous messageGo to next message
Eclipse User
Originally posted by: mowens72.gmail.com

I just figured this out with some trial and error. In case anyone else
is interested, this is how I took an SWT image from a canvas and turned
it into a PNG with alpha transparency:

Convert the SWT image to AWT (found a code snippet online)
Get the pixels from the AWT image
If the pixel is white (or whatever color you want to be transparent)
perform a 0x00 >> pixel, else do pixel << 0x00 to store in a new one
dimensional array
Use AWT Component's createImage function get a new AWT image
Save the AWT using Jimi with the PNGEncoder

Veronika Irvine wrote:
> The following snippet saves an animated gif - your case will be simpler but
> similar:
>
> http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org. eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet194 .java
>
> "Mike Owens" <mowens72@gmail.com> wrote in message
> news:dqr1vk$4as$1@utils.eclipse.org...
>
>>I have an SWT canvas that I can save without any problems to BMP and Jpeg.
>>Is it possible to save it as a GIF?
>>
>>Or, does anyone have a code example that will convert an SWT Image to
>>transparent GIF? Thanks!
>>
>>Mike O.
>
>
>
Re: Convert Image from BMP to GIF [message #1049771 is a reply to message #466989] Fri, 26 April 2013 08:54 Go to previous message
klausnew dfdgs is currently offline klausnew dfdgs
Messages: 7
Registered: April 2013
Junior Member
you make me think of an image converte. it will convert into the most common used formats. so BMP to GIF is simple i guess.
Previous Topic:java.awt.Image conversion?
Next Topic:Drag from SWT to Desktop
Goto Forum:
  


Current Time: Fri Oct 24 15:32:14 GMT 2014

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

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