         })
     }
     
+    // HACK: Ideally Cache shouldn't treat images differently but I can't think of any other way of doing this that doesn't complicate the API for other types.
+    private func decompressedImageIfNeeded(value : T) -> T {
+        if let image = value as? UIImage {
+            let decompressedImage = image.hnk_decompressedImage() as? T
+            return decompressedImage!
+        }
+        return value
+    }
+    
 }

//  Copyright (c) 2014 Haneke. All rights reserved.
//

import Foundation
import UIKit

// Used to add T to NSCache

        fetcher.fetchWithSuccess(success: { value in
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), {
                var formatted = format.apply(value)
                
                if let formattedImage = formatted as? UIImage {
                    let originalImage = value as? UIImage
                    if formattedImage === originalImage {
                        formatted = self.decompressedImageIfNeeded(formatted)
                    }
                }

                dispatch_async(dispatch_get_main_queue(), {
                    doSuccess(formatted)
                    self.setValue(formatted, fetcher.key, formatName: format.name)
