Skip to content

Problem with resize gif images when output quality is set #9

@GoogleCodeExporter

Description

@GoogleCodeExporter
I found a problem with resizing gif files when I set output quality. I think it 
is possible to reproduce it with any gif file.

What steps will reproduce the problem?

Sample code:
Working:
BufferedImage bi = ImageIO.read(sourceFile);
        Thumbnails.of(bi).size(90, 63).keepAspectRatio(false).toFile(destFile);

Throwing exception version:
BufferedImage bi = ImageIO.read(sourceFile);
        Thumbnails.of(bi).size(90, 63).keepAspectRatio(false).outputQuality(0.8f).toFile(destFile);


What is the expected output? What do you see instead?
Stacktrace:
Exception in thread "main" java.lang.IllegalStateException: No compression type 
set!
    at javax.imageio.ImageWriteParam.setCompressionQuality(ImageWriteParam.java:1241)
    at net.coobird.thumbnailator.tasks.io.FileImageSink.write(Unknown Source)
    at net.coobird.thumbnailator.tasks.SourceSinkThumbnailTask.write(Unknown Source)
    at net.coobird.thumbnailator.Thumbnailator.createThumbnail(Unknown Source)
    at net.coobird.thumbnailator.Thumbnails$Builder.toFile(Unknown Source)
    at ImageResize.resizeImage(ImageResize.java:26)
    at ImageResize.main(ImageResize.java:18)

What version of the product are you using? On what operating system?
0.3.2



Original issue reported on code.google.com by tomasz.t...@gmail.com on 29 Apr 2011 at 9:10

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions