Skip to content

Instantly share code, notes, and snippets.

@connectwithprakash
Created February 1, 2020 20:00
Show Gist options
  • Select an option

  • Save connectwithprakash/77aa3e5c043ca7e36c502a46ad6d51a4 to your computer and use it in GitHub Desktop.

Select an option

Save connectwithprakash/77aa3e5c043ca7e36c502a46ad6d51a4 to your computer and use it in GitHub Desktop.
Cropping image of desired aspect ratio using windowing algorithm with known center of window/
image = plt.imread(file_path)
m, n = image.shape[0:-1]
image = crop(image, center=(m//2+290, n//2), aspect_ratio=(1.4/2.0))
plt.imsave('output.jpg', image)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment