Skip to content

Instantly share code, notes, and snippets.

@BlogBlocks
Last active April 24, 2018 21:44
Show Gist options
  • Save BlogBlocks/c8393c8ecc04665cccc79f1357efd2f9 to your computer and use it in GitHub Desktop.
Save BlogBlocks/c8393c8ecc04665cccc79f1357efd2f9 to your computer and use it in GitHub Desktop.
largest center square of image
w= 1000;h=500
x=0;xy=0;y=w;yx=h
sf= abs((w-h)/2)
if w>h:x=x+sf
if w>h:y=w-sf
if w<h:xy=sf
if w <h:yx=h-sf
print (sf)
print (x, xy, y, yx)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment