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 org.apache.commons.imaging.ImageFormats;
21 import org.apache.commons.imaging.Imaging;
22 import org.apache.commons.imaging.internal.Debug;
23 import org.junit.jupiter.api.Test;
24
25 import java.awt.image.BufferedImage;
26 import java.io.File;
27 import java.util.List;
28
29 import static org.junit.jupiter.api.Assertions.assertNotNull;
30
31 public class ConvertPngToGifTest extends PngBaseTest {
32
33 @Test
34 public void test() throws Exception {
35
36 final List<File> images = getPngImages();
37 for (final File imageFile : images) {
38
39 if (isInvalidPNGTestFile(imageFile))
40 {
41 continue;
42 }
43
44 final BufferedImage image = Imaging.getBufferedImage(imageFile);
45 assertNotNull(image);
46
47 final File outFile = File.createTempFile(imageFile.getName() + ".", ".gif");
48
49 Imaging.writeImage(image, outFile, ImageFormats.GIF);
50 }
51 Debug.debug("complete.");
52 }
53
54 }