title: How can I know if the image is in RGB or BGR format?
body: <p>Is there any way to know in advance if an image used as an input to a system is in RGB or BGR format?</p>
  
  <p>I am using OpenCV with java API and I would like to convert an input image into grayscale or L*a*b* color space, but in OpenCV you have to specify first whether the image you want to convert is in RGB or BGR.</p>
  
  <p>The type of the image I am using is either <code>.jpg</code> or <code>.png</code>.</p>