Completed clue1

This commit is contained in:
Gnarwhal 2024-08-29 17:32:40 +00:00
parent 43670fb417
commit 548871f57f
Signed by: Gnarwhal
GPG key ID: 0989A73D8C421174
4 changed files with 40 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
*.iml
.idea/
out/

BIN
clue1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 KiB

1
clue1_output.txt Normal file
View file

@ -0,0 +1 @@
https://i.imgur.com/XYYUjE0.png

36
src/clue1/Main.java Normal file
View 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();
}
}
}