source: lost-perception/utils/ConvertToPNG.java@ 57674f3

Last change on this file since 57674f3 was ebd3538, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 6 years ago

Initial commit. This codebase for the Lost Perception game was created by decompiling code from a jar file.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1package utils;
2
3import java.awt.image.BufferedImage;
4import java.io.IOException;
5import java.awt.image.RenderedImage;
6import javax.imageio.ImageIO;
7import java.io.File;
8
9public class ConvertToPNG {
10 public static void main(final String[] args) {
11 final String path = "D:/workspace/LostHaven2/images/creatures/";
12 final String crName = "orc";
13 final String[] actions = { "attacking", "beenhit", "dying", "walking", "standing" };
14 for (int x = 0; x < actions.length; ++x) {
15 final File dir = new File(String.valueOf(path) + crName + "/" + actions[x]);
16 final File[] contents = dir.listFiles();
17 File[] array;
18 for (int length = (array = contents).length, i = 0; i < length; ++i) {
19 final File curFile = array[i];
20 final String curName = curFile.getName();
21 final String newName = String.valueOf(curName.substring(0, curName.indexOf("."))) + ".png";
22 try {
23 final BufferedImage img = ImageIO.read(new File(String.valueOf(path) + crName + "/" + actions[x] + "/" + curName));
24 ImageIO.write(img, "png", new File(String.valueOf(path) + crName + "/" + actions[x] + "/" + newName));
25 curFile.delete();
26 }
27 catch (IOException ioe) {
28 ioe.printStackTrace();
29 }
30 }
31 }
32 }
33}
Note: See TracBrowser for help on using the repository browser.