coobird / thumbnailator

Thumbnailator - a thumbnail generation library for Java
MIT License
5.14k stars 784 forks source link

generate multiple thumbnails #131

Closed karianpour closed 6 years ago

karianpour commented 6 years ago

Is there a way to generate multiple thumbnails with different sizes without reading the file multiple times? I guess the code bellow reads the tmp_file 3 times and parse it 3 times.

Thumbnails.of(tmp_file)
        .size(144, 144)
        .crop(Positions.CENTER)
        .outputQuality(0.85)
        .toFile(small_file);

Thumbnails.of(tmp_file)
        .size(512, 512)
        .outputQuality(0.95)
        .toFile(medium_file);

Thumbnails.of(tmp_file)
        .size(2048, 2048)
        .outputQuality(0.95)
        .toFile(max_file);
coobird commented 6 years ago

At the current time, aside from the way you mention, there isn't a way to create multiple thumbnails without reading the source input multiple times.

This has been requested in the past (issue #29), and if I have the chance to refactor Thumbnailator, I'll keep this in mind. For now, since this is a duplicate issue I'll be closing this one.

If you have additional comments feel free to add them to issue #29. Thank you for your input!