Compare commits
2 Commits
master
...
basic_filt
Author | SHA1 | Date |
---|---|---|
Hendrik Schutter | 7fc9beec45 | |
Hendrik Schutter | 7740b2e300 |
|
@ -138,3 +138,11 @@ dmypy.json
|
||||||
# Cython debug symbols
|
# Cython debug symbols
|
||||||
cython_debug/
|
cython_debug/
|
||||||
|
|
||||||
|
|
||||||
|
*.png
|
||||||
|
*.mkv
|
||||||
|
*.mp4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ import subprocess
|
||||||
import datetime
|
import datetime
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
import operator
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class MediaFile:
|
class MediaFile:
|
||||||
|
@ -97,8 +99,11 @@ def scan_files(path):
|
||||||
return media_files
|
return media_files
|
||||||
|
|
||||||
def print_all(media_files):
|
def print_all(media_files):
|
||||||
|
media_files.sort(key=lambda x: x.size, reverse=True)
|
||||||
for media_file in media_files:
|
for media_file in media_files:
|
||||||
print ("{:<64} | {:<8} | {:<16} | {:<8} | {:<16}".format(cut_file_name(media_file.name, 64), str(datetime.timedelta(seconds=media_file.duration)).split(".")[0], human_readable_size(media_file.size), media_file.codec, str(media_file.resolution[0])+"x"+str(media_file.resolution[1])))
|
#print ("{:<64} | {:<8} | {:<16} | {:<8} | {:<16}".format(cut_file_name(media_file.name, 64), str(datetime.timedelta(seconds=media_file.duration)).split(".")[0], human_readable_size(media_file.size), media_file.codec, str(media_file.resolution[0])+"x"+str(media_file.resolution[1])))
|
||||||
|
if int(media_file.resolution[0]) == 1920 and media_file.codec != "av1" and media_file.codec != "vp9":
|
||||||
|
print ('"' + media_file.name + '"')
|
||||||
|
|
||||||
def print_codecs(media_files):
|
def print_codecs(media_files):
|
||||||
codecs = list()
|
codecs = list()
|
||||||
|
@ -134,8 +139,8 @@ def main() -> None:
|
||||||
print("")
|
print("")
|
||||||
print_all(media_files)
|
print_all(media_files)
|
||||||
|
|
||||||
print("")
|
#print("")
|
||||||
print_codecs(media_files)
|
#print_codecs(media_files)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -63,7 +63,7 @@ def zoom_at(img, crop_factor):
|
||||||
image_width, image_height = img.size
|
image_width, image_height = img.size
|
||||||
img = img.crop((int(image_width/2) - int(image_width/crop_factor) / (crop_factor * 2), int(image_height/2) - int(image_height/crop_factor) / (crop_factor * 2),
|
img = img.crop((int(image_width/2) - int(image_width/crop_factor) / (crop_factor * 2), int(image_height/2) - int(image_height/crop_factor) / (crop_factor * 2),
|
||||||
int(image_width/2) + int(image_width/crop_factor) / (crop_factor * 2), int(image_height/2) + int(image_height/crop_factor) / (crop_factor * 2)))
|
int(image_width/2) + int(image_width/crop_factor) / (crop_factor * 2), int(image_height/2) + int(image_height/crop_factor) / (crop_factor * 2)))
|
||||||
return img.resize((int(image_width/crop_factor*2), int(image_height/crop_factor*2)), Image.LANCZOS)
|
return img.resize((int(image_width/crop_factor*2), int(image_height/crop_factor*2)), Image.Resampling.LANCZOS)
|
||||||
|
|
||||||
def create_collage(images_A, images_B, statistics, output_file):
|
def create_collage(images_A, images_B, statistics, output_file):
|
||||||
image_width, image_height = images_A[0].size
|
image_width, image_height = images_A[0].size
|
||||||
|
@ -112,7 +112,7 @@ def create_collage(images_A, images_B, statistics, output_file):
|
||||||
cropped_image = zoom_at(images_A[i], crop_factor)
|
cropped_image = zoom_at(images_A[i], crop_factor)
|
||||||
cropped_image_with, _ = cropped_image.size
|
cropped_image_with, _ = cropped_image.size
|
||||||
output_image.paste(cropped_image, (int(x_offset/2) + image_width - cropped_image_with , y))
|
output_image.paste(cropped_image, (int(x_offset/2) + image_width - cropped_image_with , y))
|
||||||
cropped_image = zoom_at(images_B[i].transpose(PIL.Image.FLIP_LEFT_RIGHT), crop_factor)
|
cropped_image = zoom_at(images_B[i].transpose(PIL.Image.Transpose.FLIP_LEFT_RIGHT), crop_factor)
|
||||||
output_image.paste(cropped_image, (int(x_offset/2) + image_width, y))
|
output_image.paste(cropped_image, (int(x_offset/2) + image_width, y))
|
||||||
i += 1
|
i += 1
|
||||||
y += image_height
|
y += image_height
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.2 MiB |
Loading…
Reference in New Issue