title: skimage resize giving weird output
body: <p>I'm resizing an image using <code>skimage.transform.resize</code> but I'm getting a really weird output and I can't figure out why. Can anyone help?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import skimage.transform
  plt.imshow(y)
  h,w,c = y.shape
  x = skimage.transform.resize(y, (256, (w*256)/h), preserve_range=True)
  plt.imshow(x)
  </code></pre>
  
  <p>Here is my input image y (240, 320, 3):</p>
  
  <p><a href="https://i.stack.imgur.com/GAQzq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GAQzq.png" alt="enter image description here"></a></p>
  
  <p>Here is my output image x (256, 341, 3):</p>
  
  <p><a href="https://i.stack.imgur.com/YHmFJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/YHmFJ.png" alt="enter image description here"></a></p>
  
  <p><strong>Edit:</strong>
  Okay it seems to work fine if I change <code>preserve_range=False</code>. But why won't it allow me to keep the current range?</p>
  
  <p><strong>Edit:</strong>
  I'm randomly sampling frames from videos using OpenCV. Here's the function that returns a frame from the video path I pass to it.</p>
  
  <pre><code>def read_random_frames(vid_file):
  
     vid = cv2.VideoCapture(vid_file)
     # get the number of frames    
     num_frames = vid.get(cv2.CAP_PROP_FRAME_COUNT)
     # randomly select frame
     p_frame = random.randint(0, (num_frames-1))
     # get frame
     vid.set(cv2.CAP_PROP_POS_FRAMES, p_frame)
     ret, frame = vid.read()
     # convert from BGR to RGB
     frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
  
     return frame
  </code></pre>
  
  <p>I have a list of video paths and I use a <code>map</code> function to retrieve the frames then I convert the outputed list to a numpy array:</p>
  
  <pre><code> batch_frames = map(lambda vid: read_random_frames(vid), train_vids_batch)
   frame_tensor = np.asarray(batch_frames)
   y = frame_tensor[0]
  </code></pre>