Skip to content

Commit a765495

Browse files
committed
StitchTool v4.0.1
Changed smart splitting for a wider range of colors += 10 for rgb error.
1 parent 721fc4a commit a765495

16 files changed

+17
-179
lines changed

Stitch.iml

-30
This file was deleted.

pom.xml

-140
This file was deleted.

src/main/java/Controller.java src/Controller.java

+16-5
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,10 @@ public int smartSplitHelper(BufferedImage image) {
10741074
Color c2 = Util.getColor(image.getRGB(j + 1, i));
10751075

10761076
// Checks if the row of pixels is the same color, if not, moves 1 pixel down
1077-
if (!(c1.getAlpha() == c2.getAlpha() && c1.getRed() == c2.getRed() && c1.getGreen() == c2.getGreen() && c1.getBlue() == c2.getBlue())) {
1077+
if (!(c2.getAlpha()-10 <= c1.getAlpha() && c1.getAlpha() <= c2.getAlpha()+10 &&
1078+
c2.getRed()-10 <= c1.getRed() && c1.getRed() <= c2.getRed()+10 &&
1079+
c2.getGreen()-10 <= c1.getGreen() && c1.getGreen() <= c2.getGreen()+10 &&
1080+
c2.getBlue()-10 <= c1.getBlue() && c1.getBlue() <= c2.getBlue()+10)) {
10781081
break;
10791082
}
10801083
// Otherwise, it saves the height to split, and moves to the next part
@@ -1116,12 +1119,13 @@ public int smartSplitHelper(BufferedImage image) {
11161119

11171120
// Waifu2X the image
11181121
public boolean waifuHelper(File f) {
1122+
11191123
// If the waifu2x.exe is not found
11201124
if (waifuPath.equalsIgnoreCase("NOT FOUND") || (!denoiseBox.isSelected() && !scaleBox.isSelected())) {
11211125
return false;
11221126
}
11231127

1124-
int sf = (int) scaleSlider.getValue();
1128+
int sf = (int) Math.pow(2, scaleSlider.getValue());
11251129
String shf = scaleHeightField.getText();
11261130
String swf = scaleWidthField.getText();
11271131

@@ -1168,7 +1172,7 @@ public boolean waifuHelper(File f) {
11681172
cmd.add("-o");
11691173
cmd.add("\"" + outputField.getText() + nameField.getText() + "_waifu." + fileOption + "\"");
11701174

1171-
if (waifuPath.contains("CAFFE")) {
1175+
if (waifuPath.contains("caffe")) {
11721176
// NOISE AND SCALE
11731177
cmd.add("-m");
11741178
if (denoiseBox.isSelected() && scaleBox.isSelected()) {
@@ -1206,7 +1210,7 @@ else if (denoiseBox.isSelected() && !scaleBox.isSelected()) {
12061210
cmd.add("--model_dir");
12071211
cmd.add(new File(waifuField.getText()).getParent() + File.separator + "models" + File.separator + modelOptions.getValue());
12081212
}
1209-
else if (waifuPath.contains("VULKAN")) {
1213+
else if (waifuPath.contains("vulkan")) {
12101214
if (denoiseBox.isSelected()) {
12111215
cmd.add("-n");
12121216
cmd.add(((int) denoiseSlider.getValue()) + "");
@@ -1237,14 +1241,21 @@ else if (waifuPath.contains("VULKAN")) {
12371241
Alert a = new Alert(Alert.AlertType.INFORMATION);
12381242
a.setHeaderText(null);
12391243
if (denoiseBox.isSelected() && scaleBox.isSelected()) {
1240-
a.setContentText("Image has been denoised with level " + (int) denoiseSlider.getValue() + " and scaled by " + (int) Math.pow(2, sf) + "!");
1244+
a.setContentText("Image has been denoised with level " + (int) denoiseSlider.getValue() + " and scaled by " + sf + "!");
12411245
} else if (denoiseBox.isSelected() && !scaleBox.isSelected()) {
12421246
a.setContentText("Image has been denoised with level " + (int) denoiseSlider.getValue());
12431247
} else if (!denoiseBox.isSelected() && scaleBox.isSelected()) {
12441248
a.setContentText("Image has been scaled by " + sf + "!");
12451249
}
12461250
a.showAndWait();
12471251
}
1252+
1253+
for (int i = 1; i < cmd.size(); i++) {
1254+
System.out.print(cmd + " ");
1255+
}
1256+
System.out.println("END");
1257+
1258+
12481259
return true;
12491260
}
12501261
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/main/resources/META-INF/MANIFEST.MF

-3
This file was deleted.
File renamed without changes.
File renamed without changes.

target/Stitch-1.0-SNAPSHOT.jar

134 Bytes
Binary file not shown.

target/classes/Controller.class

630 Bytes
Binary file not shown.

target/maven-archiver/pom.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Generated by Maven
2-
#Tue Dec 28 21:03:51 EST 2021
2+
#Sat Jan 08 05:12:30 EST 2022
33
groupId=me.aeonss
44
artifactId=Stitch
55
version=1.0-SNAPSHOT
134 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)