Skip to content

Instantly share code, notes, and snippets.

@hrehfeld
Last active March 14, 2018 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrehfeld/7f84a016e8acdb84e756a24b4113f6db to your computer and use it in GitHub Desktop.
Save hrehfeld/7f84a016e8acdb84e756a24b4113f6db to your computer and use it in GitHub Desktop.
w_max = 2000
w_export = 507
export_ws = {}
# try all heights of crop rectangle
for w in range(w_export, w_max):
h = int(w * 2 / 3)
# now scale to export size with actual aspect ratio
h_export = int(w_export * h / w)
export_ws.setdefault(h_export, [])
export_ws[h_export].append(w)
for h in export_ws:
print('%s export height with these crop rectangle widths:\n %s...' % (h, export_ws[h][:10]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment