iosswiftxmp

How to implement XMP preset filters on images in iOS


I have a XMP file and need to apply XMP filters on an image. I have converted it into CFData but not able to read dictionary or array format. I have researched about XMP file in iOS, but I don't think it can implemented by changing meta data of image.

My XMP file can be downloaded from link below:

https://drive.google.com/file/d/1rUcjkT5rcV_rG89blTLJfvL9AgOvmWUX/view?usp=sharing


Solution

  • Method :- You can convert your XMP file to json file and apply filters on image.

    If you want to convert your XMP into json then can use python-xmp-toolkit or my convertXMPToJson.

    If you are using my python file then just need to set path on your terminal and run below command.

    python convertXMPToJson.py XMP/your_XMP_file_Name.xmp json/your_Json_file_Name.json
    

    It convert your xmp file to json file and you can apply CIFilter or write custom filter using CIKernel, Metal.

    Sample CIFilter

    let imgFilter = CIFilter(name: "CIExposureAdjust")
    imgFilter?.setValue(value, forKey: kCIInputEVKey)
    filter.setValue(image, forKey: kCIInputImageKey)
    guard let filteredImage = filter.value(forKey: kCIOutputImageKey) else { return image }
    

    You can find sample filter at here.

    Lot of CIFilter available in Core Image. You can find other CIFilter at here.