Why does MinMaxScaler add lines to image?
<p>I want to normalize the pixel values of an image to the range [0, 1] for each channel (R, G, B).</p>

<h2>Minimal Example</h2>

<pre><code>#!/usr/bin/env python

import numpy as np
import scipy
from sklearn import preprocessing

original = scipy.misc.imread('Crocodylus-johnsoni-3.jpg')
scipy.misc.imshow(original)

transformed = np.zeros(original.shape, dtype=np.float64)

scaler = preprocessing.MinMaxScaler()
for channel in range(3):
    transformed[:, :, channel] = scaler.fit_transform(original[:, :, channel])
scipy.misc.imsave("transformed.jpg", transformed)
</code></pre>

<h2>What happens</h2>

<p>Taking <a href="https://commons.wikimedia.org/wiki/File:Crocodylus-johnsoni-3.jpg" rel="nofollow noreferrer">https://commons.wikimedia.org/wiki/File:Crocodylus-johnsoni-3.jpg</a>,
I get the following "normalized" result:</p>

<p><a href="https://i.stack.imgur.com/osBvP.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/osBvP.jpg" alt="enter image description here"></a></p>

<p>As you can see there are lines from top to bottom at the right side. What happened there? It seems to me that the normalization went wrong. If so: How do I fix it?</p>