Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / May 2004

Tip: Looking for answers? Try searching our database.

IOImage.write failure

Thread view: 
Roedy Green - 19 May 2004 07:26 GMT
This code works for "JPEG" but not "gif" or "GIF".

Why?

// repaint onto a BufferedImage
BufferedImage bufferedImage = new BufferedImage ( width + inset * 2,
                                                height + inset * 2,

BufferedImage.TYPE_INT_RGB);

Graphics2D g2d = (Graphics2D) (bufferedImage.createGraphics());

// redraw using our paintComponent
paintComponent(  g2d );

// write out the BufferedImage as a GIF
ImageIO.write( bufferedImage,
                             "gif" /* format desired */,
                             file );
         
Signature

Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Roedy Green - 19 May 2004 07:45 GMT
>// repaint onto a BufferedImage
>BufferedImage bufferedImage = new BufferedImage ( width + inset * 2,
[quoted text clipped - 11 lines]
>                "gif" /* format desired */,
>                file );

I tried this with all 14 Image types, and each time
ImageIO.getWriterFormatNames told me only PNG and JPEG were supported,
no GIF.

I thought the Unisys GIF patent had expired.

Signature

Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Thomas Weidenfeller - 19 May 2004 09:59 GMT
> I thought the Unisys GIF patent had expired.

AFAIK, IANAL, not in all parts of the world. And once this has happened,
Sun will need some time to get it into the implementation. Taking Sun's
usual "speed" into account, I would guess we are talking years here.

/Thomas
Thomas A. Russ - 20 May 2004 19:26 GMT
> This code works for "JPEG" but not "gif" or "GIF".
>
> Why?

Because JPEG is an open standard and GIF is not.
The GIF format is protected because it uses the patented
LZW compression algorithm.  That means that in order to
create GIFs, you need a license from the owner (I can't
recall offhand who that is right now).

They allow free decoding of the format, but not encoding.
That is why you won't find an easily available GIF encoder.

> // repaint onto a BufferedImage
> BufferedImage bufferedImage = new BufferedImage ( width + inset * 2,
[quoted text clipped - 10 lines]
>                               "gif" /* format desired */,
>                               file );

Signature

Thomas A. Russ,  USC/Information Sciences Institute



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.