title: How to use kCGImageDestinationLossyCompressionQuality in saving GIF from video
body: <p>I am using the Regift (<a href="https://github.com/matthewpalmer/Regift" rel="nofollow">https://github.com/matthewpalmer/Regift</a>) library to convert videos to GIFs, but I don't like how large the file size of the saved GIFs are. The library is using the <code>CGImageDestinationAddImage</code> function to add each frame of the video to a file, and one of the parameters of this function is a dictionary that lets you specify properties of the image, and one of the properties you can set is called <code>kCGImageDestinationLossyCompressionQuality</code> which I want to use to try to reduce the file size.</p>
  
  <p>This is the original code in the library that defines the properties dictionary to be passed into the <code>CGImageDestinationAddImage</code> function:</p>
  
  <pre><code>let frameProperties = [kCGImagePropertyGIFDictionary as String:
  [
      kCGImagePropertyGIFDelayTime as String: delayTime
  ]]
  </code></pre>
  
  <p>I'm trying to modify this dictionary to include the <code>kCGImageDestinationLossyCompressionQuality</code> property:</p>
  
  <pre><code>let frameProperties = [
  kCGImageDestinationLossyCompressionQuality as String: 0.5,
  kCGImagePropertyGIFDictionary as String:
  [
      kCGImagePropertyGIFDelayTime as String: delayTime
  ]]
  </code></pre>
  
  <p>But when I try re-converting the same video file into a GIF, there is no difference in quality or file size, which means setting that property had no effect. Am I not setting it correctly? Or does this property just have no effect for GIF frames?</p>