title: Keras ImageDataGenerator with center crop for rotation and translation shift
body: <p>I need to do data augmentation but not with any fill modes, <code>constant</code>, <code>reflect</code>, <code>nearest</code>, <code>wrap</code>. Instead everytime the image is rotated or translated, I would like to have it center-cropped (shown below) so as not have any black, white, reflected, or constant edges/borders as explained <a href="https://stackoverflow.com/a/50906665/3125070">here</a>.</p>
  
  <p><a href="https://i.stack.imgur.com/Gyiwy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Gyiwy.png" alt="enter image description here"></a></p>
  
  <p>How do I extend the <code>ImageDataGenerator</code> class (if that's the only way to do it and no center crop is available out of the box) with these points taken into account?</p>
  
  <ol>
  <li><p>Keep existing parts of the <a href="https://keras.io/preprocessing/image/" rel="noreferrer">ImageDataGenerator</a> other than the augmentation part, and write a custom augmentation function</p></li>
  <li><p>It would be efficient to retain the images of original size without resizing  before augmentation happens because center crop would result in huge loss of data after resize. <code>Translate/Rotate -&gt; Center crop -&gt; Resize</code> should be more efficient than <code>Resize -&gt; Translate/Rotate -&gt; Center crop</code></p></li>
  </ol>