title: Why do some images have third dimension 3 while others have 4?
body: <p>I don't have much knowledge of image processing. I am trying to implement a ConvNet. I downloaded some images as data set and made their  height and width equal. Then I tried loading them into np.array by this code:</p>
  
  <pre><code>train_list = glob.glob('A:\Code\Machine 
  Learning\CNN\ConvolutionalNN1\TrainImg\*.jpg')
  X_train_orig = np.array([np.array(Image.open(file)) for file in train_list])
  </code></pre>
  
  <p>But it gave me error that cannot broadcast (420,310) to (420,310,3). Then I printed the shape of array, some were (420,310,3) others (410,320,4). Why is so? And how can I change that to fit it in array? </p>