ImageIO, error when trying gif

P

Peter the Swede

Groupmembers,

I'm using the following to write to a file. The writers.next() generates
NoSuchElementExeption, shouldn't "gif" be a correct input to
getImageWritersByFormatName(...)?

Iterator writers = ImageIO.getImageWritersByFormatName("gif");
ImageWriter writer = (ImageWriter)writers.next();
 
S

Sudsy

Peter said:
Groupmembers,

I'm using the following to write to a file. The writers.next() generates
NoSuchElementExeption, shouldn't "gif" be a correct input to
getImageWritersByFormatName(...)?

Iterator writers = ImageIO.getImageWritersByFormatName("gif");
ImageWriter writer = (ImageWriter)writers.next();


According to the javadocs, NoSuchElementException is thrown by the
Iterator.next method when "iteration has no more elements". Seems
clear enough to me! Now, it shouldn't be surprising that Sun doesn't
include gif writers in their distribution. Unisys is exerting patent
rights to the format and is demanding license fees from companies
which incorporate the patented algorithms in products. Sun is just
avoiding problems. You could do a search on the 'net for third-party
writers...
 
M

Marco Schmidt

Peter the Swede:
I'm using the following to write to a file. The writers.next() generates
NoSuchElementExeption, shouldn't "gif" be a correct input to
getImageWritersByFormatName(...)?

Iterator writers = ImageIO.getImageWritersByFormatName("gif");
ImageWriter writer = (ImageWriter)writers.next();

ImageIO does not come with a GIF encoder.

Check out
<http://www.geocities.com/marcoschmidt.geo/java-image-coding.html>
instead.

Regards,
Marco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top