         height = Int(image.size.height)
         
         let bytesPerRow = width * 4
-        let imageData = UnsafeMutablePointer<Pixel>.allocate(capacity: width * height)
+        imageData = UnsafeMutablePointer<Pixel>.allocate(capacity: width * height)
         
         let colorSpace = CGColorSpaceCreateDeviceRGB()
         


import UIKit

public struct ImagePallete {
    public var pixels: UnsafeMutableBufferPointer<Pixel>
    public var width: Int
    public var height: Int
    

        imageContext.draw(cgImage, in: CGRect(origin: .zero, size: image.size))
        
        pixels = UnsafeMutableBufferPointer(start: imageData, count: width * height)
    }
    
    deinit {
        self.imageData.deallocate(capacity: width * height)
    }
    
    func calculateKMeans() -> [Pixel] {
