How do I restrict uploaded images to a specific aspect ratio?
My advice would be to implement a custom file validator.

To see how these are used when saving files, you can check out file_save_upload. For an example implementation that is very close to what you want to achieve, check out file_validate_image_resolution.

My super quick attempt at this

/**
 * Validates an image upload as having a particular aspect ratio
 *
 * @param $file
 *   - the uploaded file
 * @param $aspect_ratio
 *   - the apect ratio in the format [WIDTH]:[HEIGHT]. E.g. '3:2'
 */
function file_validate_image_aspect(stdClass $file, $aspect_ratio = 0) {
  $errors = array();

  // Check first that the file is an image.
  if ($info = image_get_info($file-&gt;uri)) {
    if ($aspect_ratio) {
      // Check that it is smaller than the given dimensions.
      list($width, $height) = explode(':', $aspect_ratio);
      if ($width * $info['height'] != $height * $info['width']) {
        $errors[] = t('The image is the wrong aspect ratio; the aspect ratio needed is %ratio.', array('%ratio' =&gt; $aspect_ratio));
      }
    }
  }

  return $errors;
}