          with self._cache["cropped_roi"][1]:
              if centering not in self._cache["cropped_roi"][0]:
                  offset = self.pose.offset.get(centering, np.float32((0, 0)))  # legacy = 0,0
                  offset -= self.pose.offset["head"]
                  offset *= (self.size - (self._size * _EXTRACT_RATIOS["head"]))
  
                  center = np.rint(offset + self._size / 2).astype("int32")
                  padding = self.get_cropped_size(centering) // 2
                  roi = np.array([center - padding, center + padding]).ravel()
                  logger.trace("centering: '%s', center: %s, padding: %s, sub roi: %s",
 
</s> remove                 center = np.rint(offset + self._size / 2).astype("int32")
                padding = self.get_cropped_size(centering) // 2
 </s> add                 center = np.rint(offset + self._head_size / 2).astype("int32")
                padding = self.size // 2 </s> remove         if self._centering != "head":
            raise ValueError("Sub ROI can only be obtained from an aligned face with 'head' "
                             "centering")
 </s> add  </s> remove         crop_size = 2 * int(np.rint(src_size / (1 - _EXTRACT_RATIOS["legacy"]) / 2))
 </s> add         crop_size = get_centered_size("face", "legacy", self.stored_size) </s> remove         src_size = self.size - (self._size * _EXTRACT_RATIOS[self._centering])
        head_size = 2 * int(np.rint(src_size / (1 - _EXTRACT_RATIOS["head"]) / 2))
        if head_size != image.shape[0]:
            interp = cv2.INTER_CUBIC if image.shape[0] < head_size else cv2.INTER_AREA
            image = cv2.resize(image, (head_size, head_size), interpolation=interp)

        # store requested size + centering whilst temporary converting to full head extract
        old_centering = self._centering
        old_size = self.size
        self._centering = "head"
        self._size = image.shape[0]

        # crop the requested centering from image
        size = self.get_cropped_size(old_centering)
        out = np.zeros((size, size, image.shape[-1]), dtype=image.dtype)
        slices = self.get_cropped_slices(old_centering)
 </s> add         logger.trace("head_size: %s, image_size: %s, target_size: %s",
                     self._head_size, image.shape[0], self.size)
        if self._head_size != image.shape[0]:
            interp = cv2.INTER_CUBIC if image.shape[0] < self._head_size else cv2.INTER_AREA
            image = cv2.resize(image, (self._head_size, self._head_size), interpolation=interp)

        out = np.zeros((self.size, self.size, image.shape[-1]), dtype=image.dtype)
        slices = self._get_cropped_slices() </s> remove                 slice_out = [slice(max(roi[1] * -1, 0), size - max(0, roi[3] - self.size)),
                             slice(max(roi[0] * -1, 0), size - max(0, roi[2] - self.size))]
                self._cache["cropped_slices"][0][centering] = {"in": slice_in, "out": slice_out}
 </s> add                 slice_out = [slice(max(roi[1] * -1, 0), self._size - max(0, roi[3] - head_size)),
                             slice(max(roi[0] * -1, 0), self._size - max(0, roi[2] - head_size))]
                self._cache["cropped_slices"][0][self._centering] = {"in": slice_in,
                                                                     "out": slice_out}
                offset *= (self._head_size - (self._head_size * _EXTRACT_RATIOS["head"]))
          with self._cache["cropped_roi"][1]:
              if centering not in self._cache["cropped_roi"][0]:
                  offset = self.pose.offset.get(centering, np.float32((0, 0)))  # legacy = 0,0
                  offset -= self.pose.offset["head"]
                offset *= (self._head_size - (self._head_size * _EXTRACT_RATIOS["head"]))
  
                  center = np.rint(offset + self._size / 2).astype("int32")
                  padding = self.get_cropped_size(centering) // 2
                  roi = np.array([center - padding, center + padding]).ravel()
                  logger.trace("centering: '%s', center: %s, padding: %s, sub roi: %s",
keep keep keep keep replace keep keep keep keep keep
 Bugfix - Warp to landmarks 
lib/align/aligned_face.py