title: Convert Gif image to NSData
body: <p>I have a gif image in my photo album. When I use the <code>UIImagePickerController</code> to select that image, I need to convert the image to <code>NSData</code> for storing. </p>
  
  <p>Earlier, I used </p>
  
  <pre><code>NSData *thumbData = UIImageJPEGRepresentation(thumbnail, 0.5);
  </code></pre>
  
  <p>but it will not work with gif images. <code>thumbData</code> will be nil. </p>
  
  <ol>
  <li><p>How can I get <code>NSData</code> from the gif image? </p></li>
  <li><p>How can I know that it is a gif image that needs special handing?</p></li>
  </ol>