title: Convolution of an Image in python
body: <p>I run the following script
      from PIL import Image
      import numpy as np
      from scipy import signal as sg</p>
  
  <pre><code>from PIL import Image
  import numpy as np
  from scipy import signal as sg
  
  def np_from_img(fname):
  return np.asarray(Image.open(fname), dtype=np.float32)
  
  def save_as_img(ar, fname):
  Image.fromarray(ar.round().astype(np.uint8)).save(fname)
  
  def norm(ar):
  return 255.*np.absolute(ar)/np.max(ar)
  
  img="src/img.png"
  save_as_img(norm(sg.convolve(img, [[1.],[-1.]])), 'src/portal-h.png')
  </code></pre>
  
  <p>I am having the following error:
  ValueError: in1 and in2 should have the same dimensionality</p>
  
  <p>Does anyone know why?</p>