Completed clue1
This commit is contained in:
parent
c76862a8ac
commit
66cf575ca2
4 changed files with 40 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
*.iml
|
||||
.idea/
|
||||
out/
|
BIN
clue1.png
Normal file
BIN
clue1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 404 KiB |
1
clue1_output.txt
Normal file
1
clue1_output.txt
Normal file
|
@ -0,0 +1 @@
|
|||
https://i.imgur.com/XYYUjE0.png
|
36
src/clue1/Main.java
Normal file
36
src/clue1/Main.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package clue1;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
FileInputStream stream = new FileInputStream("clue1.png");
|
||||
BufferedImage image = ImageIO.read(stream);
|
||||
int width = image.getWidth();
|
||||
int height = image.getHeight();
|
||||
int[] raw = image.getRGB(0, 0, width, height, null, 0, width);
|
||||
|
||||
FileOutputStream output = new FileOutputStream("clue1_output.txt");
|
||||
byte yeet = 1;
|
||||
for (int i = 0; i < raw.length && yeet != 0; i += (8 * 34)) {
|
||||
int index = i / 8;
|
||||
yeet = 0;
|
||||
for (int j = 0; j < 8; ++j) {
|
||||
yeet <<= 1;
|
||||
yeet |= (raw[i + j * 34] & 1);
|
||||
}
|
||||
if (yeet != 0)
|
||||
output.write(yeet);
|
||||
}
|
||||
output.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue