title: Maintaining transparency with palette mode GIFs in Pillow
body: <p>I am trying to take a GIF with a palette containing one transparency index and use Pillow to create cropped sub-images. However, when using the crop() method the results no longer are transparent.</p>
  
  <pre><code>original = Image.open("filename.gif")
  print(original.mode) # prints "P", as it should
  transparent = original.info["transparency"]
  print(transparent) # prints the correct index of the transparent color
  cropped = original.crop((0, 0, 10, 10))
  print(cropped.info) # transparency no longer present
  cropped.info["transparency"] = 255
  print(cropped.info) # key is entered, but not transparent in a drawn image
  </code></pre>
  
  <p>How can I  maintain or restore the transparent index through manipulations in Pillow? As shown above, even if I "brute-force" add the transparency index back into the "info" dictionary, that is obviously not where Python is looking for the index to be specified. The documentation also mentions that certain methods like crop() are lazy and do not transfer all image information, so is there a way to re-add such information to an Image object? The documentation suggests I can do so by saving a new GIF file, but I won't need the sub-images after the program is finished running and displaying them.</p>
  
  <p>edited to add the below additional information:</p>
  
  <p><a href="https://i.stack.imgur.com/JPM8r.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JPM8r.gif" alt="the original image"></a>
  The original image, made in GIMP (circle is red, marked as the transparent color using IrfanView)</p>
  
  <p><a href="https://i.stack.imgur.com/ZGbJg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZGbJg.png" alt="code output"></a>
  The output of my code, with the circle reverting to a visible red</p>
  
  <p>My entire program is here:</p>
  
  <pre><code>from tkinter import *
  from tkinter import ttk
  from PIL import Image
  from PIL import ImageTk
  
  class Main:
      def __init__(self):
          self.root = Tk()
          self.background = Canvas(self.root)
          self.background.grid(column=0,row=0)
          self.Draw()
  
      def Draw(self):
          original = Image.open("Transparency_test.gif")
          print(original.mode) # prints "P", as it should
          transparent = original.info["transparency"]
          print(transparent) # prints the correct index of the transparent color
          cropped = original.crop((0, 0, 50, 50))
          print(cropped.info) # transparency no longer present
  
          test_uncropped = ImageTk.PhotoImage(image=original)
          test_cropped = ImageTk.PhotoImage(image=cropped)
  
          self.background.create_image((0,0), image=test_uncropped, anchor=NW)
          self.background.create_image((100,0), image=test_cropped, anchor=NW)
  
          self.root.mainloop()
  
  instance = Main()
  </code></pre>