Skip to content

Commit 2f3eec6

Browse files
committed
added converter
1 parent 7c80109 commit 2f3eec6

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed
1.72 KB
Binary file not shown.
-21 Bytes
Binary file not shown.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.rahul.chessvision;
2+
3+
import java.io.BufferedReader;
4+
import java.io.File;
5+
import java.io.FileReader;
6+
7+
public class CreateImage {
8+
9+
private static String FILE_PATH = "/home/rahul/Documents/deep_workspace/DeepLearning/logs/game4.fen";
10+
11+
private static void readAndConvert() {
12+
String fen;
13+
int counter = 0;
14+
BufferedReader br = null;
15+
try {
16+
br = new BufferedReader(new FileReader(new File(FILE_PATH)));
17+
while ((fen = br.readLine()) != null) {
18+
if (!DrawBoard.fenToPng(fen))
19+
System.out.println("Oops! Check code..");
20+
Thread.sleep(50);
21+
counter++;
22+
}
23+
} catch (Exception e) {
24+
e.printStackTrace();
25+
}
26+
System.out.println(counter + " images created.");
27+
}
28+
29+
public static void main(String[] args) {
30+
readAndConvert();
31+
}
32+
}

ChessVision/src/com/rahul/chessvision/DrawBoard.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class DrawBoard {
1010
private static final String PRE_STRING_PATH = "./html/pre.txt";
1111
private static final String POST_STRING_PATH = "./html/post.txt";
1212
private static final String HTML_FILE_PATH = "./html/index.html";
13-
private static final String CMD = "./lib/wkhtmltoimage.exe --crop-w 412 ./html/index.html ./img/";
13+
private static final String CMD = "./lib/wkhtmltoimage --crop-w 412 ./html/index.html ./img/";
1414

1515
public static boolean fenToHtml(String fen) {
1616
String html = "", line;
@@ -51,7 +51,7 @@ private static boolean htmlToPng() {
5151
}
5252

5353
public static boolean fenToPng(String fen) {
54-
return fenToHtml(fen) && htmlToPng();
54+
return fenToHtml(fen) & htmlToPng();
5555
}
5656

5757
public static void main(String[] args) {

0 commit comments

Comments
 (0)