         
         do {
             
-            let colorSpace = photometric == 8 ? AnyColorSpace(.cieLab(white: Point(x: 0.34567, y: 0.35850))) : image.colorSpace
-            guard let iccData = colorSpace.iccData else { return nil }
-            
             data.encode(TIFFTag.Tag.IccProfile.rawValue.bigEndian)
             data.encode(UInt16(7).bigEndian)
             data.encode(UInt32(iccData.count).bigEndian)

            bitsPerChannel = 16
            
            if photometric == 8 {
                if image.base is Image<FloatColorPixel<LabColorModel>> {
                    pixelData = rawData(Image<FloatColorPixel<LabColorModel>>(image: image, colorSpace: .cieLab(white: Point(x: 0.34567, y: 0.35850))), isOpaque)
                } else {
                    pixelData = rawData(Image<ColorPixel<LabColorModel>>(image: image, colorSpace: .cieLab(white: Point(x: 0.34567, y: 0.35850))), isOpaque)
                }
            } else {
                let image = image.base as! TIFFRawRepresentable

    
    static func encode(image: AnyImage, properties: [ImageRep.PropertyKey : Any]) -> Data? {
        
        let isOpaque = image.isOpaque
        let samplesPerPixel = isOpaque ? image.colorSpace.numberOfComponents : image.colorSpace.numberOfComponents + 1
        
