1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.imaging.formats.png;
19
20 import static org.junit.jupiter.api.Assertions.assertNotNull;
21
22 import java.awt.image.BufferedImage;
23 import java.io.File;
24 import java.nio.file.Files;
25 import java.util.List;
26
27 import org.apache.commons.imaging.ImageFormats;
28 import org.apache.commons.imaging.Imaging;
29 import org.apache.commons.imaging.internal.Debug;
30 import org.junit.jupiter.api.Test;
31
32 public class ConvertPngToGifTest extends AbstractPngTest {
33
34 @Test
35 public void test() throws Exception {
36
37 final List<File> images = getPngImages();
38 for (final File imageFile : images) {
39
40 if (isInvalidPngTestFile(imageFile)) {
41 continue;
42 }
43
44 final BufferedImage image = Imaging.getBufferedImage(imageFile);
45 assertNotNull(image);
46
47 final File outFile = Files.createTempFile(imageFile.getName() + ".", ".gif").toFile();
48
49 Imaging.writeImage(image, outFile, ImageFormats.GIF);
50 }
51 Debug.debug("complete.");
52 }
53
54 }