-
Notifications
You must be signed in to change notification settings - Fork 4
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
1 parent
4391daa
commit 6325782
Showing
8 changed files
with
103 additions
and
81 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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
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,22 @@ | ||
with open("bild.bin", "rb") as file: | ||
# Lese Breite und Höhe des Bildes aus den ersten beiden Bytes | ||
breite = int.from_bytes(file.read(1), byteorder='big') | ||
hoehe = int.from_bytes(file.read(1), byteorder='big') | ||
|
||
# Lese Pixel-Daten aus der restlichen Datei | ||
pixel_bytes = file.read() | ||
pixel_data = [] | ||
for byte in pixel_bytes: | ||
for i in range(8): | ||
pixel_data.append(byte >> i & 1) | ||
|
||
# Gebe das Bild als ASCII-Art aus | ||
for y in range(breite): | ||
for x in range(hoehe): | ||
index = x * breite + y | ||
pixel = pixel_data[index] | ||
if pixel == 1: | ||
print("#", end="") | ||
else: | ||
print("_", end="") | ||
print() # Neue Zeile |
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
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
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
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 |
---|---|---|
|
@@ -3,14 +3,16 @@ | |
Copyright (c) 2023, Blueforcer | ||
[email protected] | ||
All rights reserved. | ||
Some Rights Reserved. | ||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
* Redistributions of source code must retain the above copyright notice, this list | ||
of conditions and the following disclaimer. | ||
* You may not use the material for commercial purposes. | ||
* You must give appropriate credit and indicate if changes were made. | ||
You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. | ||
* Redistributions in binary form must reproduce the above copyright notice, this | ||
list of conditions and the following disclaimer in the documentation and/or other | ||
materials provided with the distribution. | ||
|