title: How to find the padding size of an image?
body: <p>I have a <code>dicom</code> image but the image is padded. I have code to remove the padding from the image so that only the scan is left but I have to open the image using ImageJ and manually find min and max values for the x and y axis for where the image starts and ends. The scan has a gray value range of <code>-3000 to 2000</code>. The padded area has a value of <code>0</code>. Is there a way to find these min and max values without having do it manually?</p>
  <p>Original Image:</p>
  <p><a href="https://i.stack.imgur.com/rKWoW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rKWoW.png" alt="enter image description here" /></a></p>
  <p>Desired Image:</p>
  <p><a href="https://i.stack.imgur.com/FZGzl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FZGzl.png" alt="enter image description here" /></a></p>