title: Inserting icc color profile into image using Pillow ImageCMS
body: <p>I am trying to insert an ICC color profile into an image. Using code from this <a href="https://stackoverflow.com/a/14537273/520779">post</a> as an example my code looks like this:</p>
  
  <pre><code>from PIL import Image, ImageCms
  
  # Read image
  img = Image.open(IMG_PATH)
  
  # Read profile
  profile = ImageCms.getOpenProfile(PROFILE_PATH)
  
  # Save image with profile
  img.save(OUT_IMG_PATH, icc_profile=profile)
  </code></pre>
  
  <p>I get the following error</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/----/Documents/code_projects/hfss-misc/icc_profiles/insert_icc_profile_into_image.py", line 17, in &lt;module&gt;
      img.save(OUT_IMG_PATH, icc_profile=srgb_profile)
    File "/home/----/.virtualenvs/color-correction/lib/python3.6/site-packages/PIL/Image.py", line 2102, in save
      save_handler(self, fp, filename)
    File "/home/----/.virtualenvs/color-correction/lib/python3.6/site-packages/PIL/JpegImagePlugin.py", line 706, in _save
      markers.append(icc_profile[:MAX_DATA_BYTES_IN_MARKER])
  TypeError: 'PIL._imagingcms.CmsProfile' object is not subscriptable
  </code></pre>
  
  <p>I thought that there might be a problem with my ICC profile so I tried to use one generated by Pillow.</p>
  
  <pre><code>from PIL import Image, ImageCms
  
  # Read image
  img = Image.open(IMG_PATH)
  
  # Creating sRGB profile
  profile = ImageCms.createProfile("sRGB")
  
  # Save image with profile
  img.save(OUT_IMG_PATH, icc_profile=profile)
  </code></pre>
  
  <p>I still get the same error, however.</p>
  
  <p>Does anyone know what the cause for this error is?</p>
  
  <p>My system environment is as follows:</p>
  
  <ul>
  <li>Ubuntu 18.04</li>
  <li>Python 3.6</li>
  <li>Pillow==7.0.0</li>
  </ul>