Skip to content

Commit

Permalink
StitchTool v4.0.1
Browse files Browse the repository at this point in the history
Changed smart splitting for a wider range of colors += 10 for rgb error.
  • Loading branch information
Aeonss committed Mar 26, 2022
1 parent 721fc4a commit a765495
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 179 deletions.
30 changes: 0 additions & 30 deletions Stitch.iml

This file was deleted.

140 changes: 0 additions & 140 deletions pom.xml

This file was deleted.

21 changes: 16 additions & 5 deletions src/main/java/Controller.java → src/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,10 @@ public int smartSplitHelper(BufferedImage image) {
Color c2 = Util.getColor(image.getRGB(j + 1, i));

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

// Waifu2X the image
public boolean waifuHelper(File f) {

// If the waifu2x.exe is not found
if (waifuPath.equalsIgnoreCase("NOT FOUND") || (!denoiseBox.isSelected() && !scaleBox.isSelected())) {
return false;
}

int sf = (int) scaleSlider.getValue();
int sf = (int) Math.pow(2, scaleSlider.getValue());
String shf = scaleHeightField.getText();
String swf = scaleWidthField.getText();

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

if (waifuPath.contains("CAFFE")) {
if (waifuPath.contains("caffe")) {
// NOISE AND SCALE
cmd.add("-m");
if (denoiseBox.isSelected() && scaleBox.isSelected()) {
Expand Down Expand Up @@ -1206,7 +1210,7 @@ else if (denoiseBox.isSelected() && !scaleBox.isSelected()) {
cmd.add("--model_dir");
cmd.add(new File(waifuField.getText()).getParent() + File.separator + "models" + File.separator + modelOptions.getValue());
}
else if (waifuPath.contains("VULKAN")) {
else if (waifuPath.contains("vulkan")) {
if (denoiseBox.isSelected()) {
cmd.add("-n");
cmd.add(((int) denoiseSlider.getValue()) + "");
Expand Down Expand Up @@ -1237,14 +1241,21 @@ else if (waifuPath.contains("VULKAN")) {
Alert a = new Alert(Alert.AlertType.INFORMATION);
a.setHeaderText(null);
if (denoiseBox.isSelected() && scaleBox.isSelected()) {
a.setContentText("Image has been denoised with level " + (int) denoiseSlider.getValue() + " and scaled by " + (int) Math.pow(2, sf) + "!");
a.setContentText("Image has been denoised with level " + (int) denoiseSlider.getValue() + " and scaled by " + sf + "!");
} else if (denoiseBox.isSelected() && !scaleBox.isSelected()) {
a.setContentText("Image has been denoised with level " + (int) denoiseSlider.getValue());
} else if (!denoiseBox.isSelected() && scaleBox.isSelected()) {
a.setContentText("Image has been scaled by " + sf + "!");
}
a.showAndWait();
}

for (int i = 1; i < cmd.size(); i++) {
System.out.print(cmd + " ");
}
System.out.println("END");


return true;
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
3 changes: 0 additions & 3 deletions src/main/resources/META-INF/MANIFEST.MF

This file was deleted.

File renamed without changes.
File renamed without changes.
Binary file modified target/Stitch-1.0-SNAPSHOT.jar
Binary file not shown.
Binary file modified target/classes/Controller.class
Binary file not shown.
2 changes: 1 addition & 1 deletion target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Generated by Maven
#Tue Dec 28 21:03:51 EST 2021
#Sat Jan 08 05:12:30 EST 2022
groupId=me.aeonss
artifactId=Stitch
version=1.0-SNAPSHOT
Binary file modified target/original-Stitch-1.0-SNAPSHOT.jar
Binary file not shown.

0 comments on commit a765495

Please sign in to comment.