-
Notifications
You must be signed in to change notification settings - Fork 136
Image.centerOrigin() off by half a pixel #85
Copy link
Copy link
Closed
Description
To find the center of an image, Image.centerOrigin() divides the image's width and height by two; since indexing starts at 0, the numerators should be width-1 and height-1.
This doesn't affect even image dimensions (e.g., for an image with a side length of 4, 4/2 = 2 is equivalent to (4-1)/2 = 1.5 since the latter rounds to 2) but the center point ends up being one pixel off the actual midpoint for sides with an odd length (e.g., 3/2 = 1.5 isn't equivalent to (3-1)/2 = 1 since the former rounds to 2). So, for a 3 x 3 image, this function will place the origin at (2,2) instead of at the centre point located at (1,1).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels