title: Pillow module - hue change when cropping and saving (no conversion)
body: <p>I want to crop an image and save it, but the problem is that the image changes hue significantly after saving the same format. Why is this happening? I'm not even converting it in the process.  </p>
  
  <p>Here is my code:</p>
  
  <pre><code>def square_crop(resized_image):
      print "square crop"
      width, height = resized_image.size
      print width,height
      edge_length = 3600
  
      if(width &gt;= height):
          print("width&gt;=height")
          left = (width - edge_length)/2
          top = (height - edge_length)/2
          right = (width + edge_length)/2
          bottom = (height + edge_length)/2
          squared_image = resized_image.crop((left, top, right, bottom))
          squared_image.save('squared.png')
  </code></pre>
  
  <p>And the confusing part is that this code uses the same image and saves it without hue change, so the cropping function must have an issue:</p>
  
  <pre><code>def image_resize(image):
      print "image resize"
      width, height = image.size
      print width,height
  
      if(width &gt; 3601 and height &gt; 3601):
          print width, height
          if(width &gt;= height):
              ratio = float(width)/float(height)
              w = 3601 * ratio
              h = 3601.0
              print ratio, w, h
              resized_image = image.resize([int(w), int(h)])
              resized_image.save("resized.png")
          else:
              ratio = float(height)/float(width)
              print(ratio)
              w = 3601.0
              h = 3601 * ratio
              print ratio, w, h
              resized_image = image.resize([int(w), int(h)])
              resized_image.save("heic1509a_resized.png")
  </code></pre>
  
  <p>*EDIT: When I import .jpg file and save to .jpg both functions have the same hue issue. Same with .tif.</p>
  
  <p>**EDIT: Also I've noticed that for some images this red color loss does not happen. I truly don't have any idea what is going on. I will leave the before and after screenshots to see for yourself.</p>
  
  <p><a href="https://i.stack.imgur.com/SlX1j.jpg" rel="nofollow noreferrer">Before</a>   -   <a href="https://i.stack.imgur.com/lTAMK.jpg" rel="nofollow noreferrer">After</a></p>
  
  <p>***EDIT: The problem is from the color space as the images that have changed color when saved were encoded using ProPhoto RGB color space(ROMM RGB (Reference Output Medium Metric)).</p>
  
  <p>I am using gimp2 to convert them first to RGB without losing color, but I would want to find a way to do that automatically from python.</p>
  
  <p>I will post any new updates on this issue.</p>