initial commit
This commit is contained in:
commit
029fb48ca6
38 files changed
+1634
No files matched your search
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
dir_path = "/Users/kyle/Desktop/kmtnflower shots"
|
||||
names = ["kmtn_homepage", "staylit_homepage"]
|
||||
|
||||
for name in names:
|
||||
png = os.path.join(dir_path, f"{name}.png")
|
||||
jpg = os.path.join(dir_path, f"{name}.jpg")
|
||||
tmp = os.path.join(dir_path, f"{name}_tmp.png")
|
||||
|
||||
subprocess.run(["sips", "--resampleWidth", "500", png, "--out", tmp], check=True)
|
||||
subprocess.run(["sips", "-s", "format", "jpeg", tmp, "--out", jpg], check=True)
|
||||
os.remove(tmp)
|
||||
|
||||
nw = subprocess.check_output(["sips", "-g", "pixelWidth", jpg]).decode().strip().split()[-1]
|
||||
nh = subprocess.check_output(["sips", "-g", "pixelHeight", jpg]).decode().strip().split()[-1]
|
||||
sz = os.path.getsize(jpg)
|
||||
print(f"{name}.jpg: {nw}x{nh} ({sz/1024:.0f} KB)")
|
||||
Reference in new issue
Block a user