Skip to content

Commit

Permalink
feat: detecting only .jpg and .png files closes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsanima committed Feb 14, 2023
1 parent 91e1789 commit 7018793
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/mdsanima_cli/pixelart.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,21 @@ def generate_pixelart(image_path: str, new_name: str, res: int) -> None:
def compute_pixelart() -> None:
"""Compute all images in folder and save with new append name."""
info = get_directory_info()
directory = os.listdir()

mprint(f"[MDSANIMA-CLI] -> compute pixelart 32px", 12)
mprint(f"[DIRECTORY PATH] -> {info['real_path']}", 40)
mprint(f" [FILES COUNT] -> {info['files_count']}", 40)
mprint(f" [IMAGE PNG] -> {info['image_png_count']}", 40)
mprint(f" [IMAGE JPG] -> {info['image_png_count']}", 40)

for image_file_name in os.listdir():
image_new_name = image_file_name[:-4] + "_pixelart.png"
generate_pixelart(image_file_name, image_new_name, 32)
mprint(f"{image_file_name} -> {image_new_name}", 25)
for image_file in directory:
extension = os.path.splitext(image_file)[-1].lower()
if extension == ".png":
image_new_name = image_file[:-4] + "_pixelart.png"
generate_pixelart(image_file, image_new_name, 32)
mprint(f"{image_file} -> {image_new_name}", 25)
if extension == ".jpg":
image_new_name = image_file[:-4] + "_pixelart.jpg"
generate_pixelart(image_file, image_new_name, 32)
mprint(f"{image_file} -> {image_new_name}", 25)

0 comments on commit 7018793

Please sign in to comment.