-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9ad5bc7
Showing
9 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Minecraft Skin Checker | ||
|
||
Verify that a minecraft skin in image format is valid. | ||
|
||
## Installation | ||
|
||
Install Minecraft Skin Checker | ||
|
||
First star my repository. | ||
:) | ||
|
||
Assuming you have Python and Git installed. | ||
|
||
```bash | ||
# Clone the repo | ||
git clone https://github.com/IParzivalDev/Minecraft-Skin-Checker.git | ||
|
||
# Move to the repository directory | ||
cd Minecraft-Skin-Checker | ||
|
||
# If you're on linux or darwin, run this command: | ||
chmod +x install.sh && chmod +x run.sh | ||
|
||
# If you are on windows you just have to change to execution permissions to the files: run.bat and install.bat | ||
|
||
# Run the install.sh in a shell if you are on linux or darwin | ||
./install.sh | ||
|
||
# If you are on windows run install.bat | ||
|
||
# If you have an installation error, create an issue and I will be able to help you. | ||
|
||
# With this, you should already have the program installed :) | ||
|
||
``` | ||
|
||
## Using | ||
|
||
If you are on linux or darwin: | ||
|
||
```bash | ||
./run.sh | ||
``` | ||
|
||
If you are on windows: | ||
|
||
```bash | ||
./run.bat | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
python3 -m venv env | ||
source ./env/bin/activate | ||
pip install -r requirements.txt | ||
echo "Minecraft Skin Checker installed successfuly. Now run: run.sh or run.bat." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
python3 -m venv env | ||
source ./env/bin/activate | ||
pip install -r requirements.txt | ||
echo "Minecraft Skin Checker installed successfuly. Now run: run.sh or run.bat." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
from PIL import Image | ||
import numpy as np | ||
import os | ||
import platform | ||
from colorama import Fore, Style | ||
|
||
|
||
def verify_skin(skin: Image) -> bool: | ||
if skin.size != (64, 64): | ||
return False | ||
|
||
m = simplify_matrix(matrix(skin)) | ||
|
||
pixels = np.array(m) | ||
|
||
sects = [ | ||
pixels[0:8, 8:24], | ||
pixels[9:16, 0:32], | ||
pixels[16:20, 20:28], | ||
pixels[16:20, 44:50], | ||
pixels[20:32, 0:54], | ||
pixels[48:52, 36:42], | ||
pixels[52:64, 16:46], | ||
] | ||
|
||
for sect in sects: | ||
if np.all(sect != 1): | ||
return False | ||
|
||
return True | ||
|
||
|
||
def simplify_matrix(matrix: list) -> list: | ||
new_matrix = [] | ||
|
||
for y in range(len(matrix)): | ||
new_row = [] | ||
for x in range(len(matrix[0])): | ||
color = matrix[y][x] | ||
|
||
if color == (0, 0, 0, 0): | ||
new_row.append(0) | ||
else: | ||
new_row.append(1) | ||
new_matrix.append(new_row) | ||
|
||
return new_matrix | ||
|
||
|
||
def matrix(img: Image) -> list: | ||
width, height = img.size | ||
|
||
pixels = [] | ||
|
||
for y in range(height): | ||
row = [] | ||
for x in range(width): | ||
r, g, b, a = img.getpixel((x, y)) | ||
row.append((r, g, b, a)) | ||
pixels.append(row) | ||
|
||
return pixels | ||
|
||
|
||
def clear(): | ||
if platform.system() == "Windows": | ||
os.system("cls") | ||
elif platform.system() == "Linux" or platform.system() == "Darwin": | ||
os.system("clear") | ||
|
||
|
||
if __name__ == "__main__": | ||
clear() | ||
try: | ||
skin = Image.open(f"{input('Enter the skin path: ')}").convert("RGBA") | ||
except: | ||
print(f"{Fore.RED}This image could not be found.{Style.RESET_ALL}") | ||
exit() | ||
|
||
if verify_skin(skin): | ||
print( | ||
f"{Fore.GREEN}This skin is valid or meets the minimum requirements.{Style.RESET_ALL}" | ||
) | ||
else: | ||
print( | ||
f"{Fore.RED}This skin is invalid or does not meet the minimum requirements.{Style.RESET_ALL}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
colorama==0.4.6 | ||
numpy==1.26.3 | ||
pillow==10.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
source ./env/bin/activate | ||
python main.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
source ./env/bin/activate | ||
python main.py |