Tuesday, May 11, 2021

#1 2021-03-24 05:37:52 am

Fredrik71
Member
Registered: 2019-10-23
Posts: 707

CIRAWFilterImpl, CIImage, CoreImage

I do not have much knowledge in RAW image and doing some tests to understand it better.

The ASObjC script ask for RAW Image ex. HEIC
There you could change parameters. I have not include every parameter option in his example.
And save the output to tiff file on the desktop.

Any input or thoughts about RAW image is always welcome or your solution in ASOBjC.

Applescript:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use framework "CoreImage"
use scripting additions
(**
* <CIRAWFilterImpl: inputRequestedSushiMode=nil inputNeutralChromaticityX=0.3457029122445338
* inputNeutralChromaticityY=0.3585386018156964 inputNeutralTemperature=5000.726168119307
* inputNeutralTint=9.616524016108169 inputNeutralLocation=[] inputEV=0 inputBoost=1
* inputDraftMode=nil inputScaleFactor=1 inputIgnoreOrientation=nil inputImageOrientation=1
* inputEnableSharpening=1 inputEnableNoiseTracking=1 inputEnableVendorLensCorrection=0
* inputNoiseReductionAmount=0 inputLuminanceNoiseReductionAmount=nil
* inputColorNoiseReductionAmount=nil inputNoiseReductionSharpnessAmount=nil
* inputNoiseReductionContrastAmount=nil inputNoiseReductionDetailAmount=nil
* inputMoireAmount=nil inputDecoderVersion=nil inputBoostShadowAmount=nil inputBias=nil
* inputBaselineExposure=nil inputDisableGamutMap=0 inputHueMagMR=nil inputHueMagRY=nil
* inputHueMagYG=nil inputHueMagGC=nil inputHueMagCB=nil inputHueMagBM=nil
* inputLinearSpaceFilter=nil>
*)


(**
* []
*)

property inputNeutralChromaticityY : 0.358538601716

(**
* [kCIInputBaselineExposureKey]
*        A key for an NSNumber object containing a float that expresses the amount of
*        baseline exposure applied to an image.
*)

property inputBaselineExposure : 0

(**
* [kCIInputEnableSharpeningKey]
*        A key for the sharpening state. The associated value must be an NSNumber object
*        that specifies a BOOL value (YES or NO). The default is YES.
*        This option has no effect if the image used for initialization is not RAW.
*)

property inputEnableSharpening : 1

(**
* [kCIInputBoostKey]
*        A key for the amount of boost to apply to an image. The associated value is a
*        floating-point value packaged as an NSNumber object. The value must be in
*        the range of 0...1. A value of 0 indicates no boost, that is, a linear response.
*        The default value is 1, which indicates full boost.
*)

property inputBoost : 1.0

set thePath to (choose file)

set theCIFilter to ciFilterRAW(thePath, inputBoost, inputEnableSharpening, inputBaselineExposure, inputNeutralChromaticityY)
saveImageDataToTiff(theCIFilter, POSIX path of (path to desktop) & "outputRAW.tiff")

on ciFilterRAW(thePath, inputBoostData, inputEnableSharpeningData, inputBaselineExposureData, inputNeutralChromaticityYData)
   set theOptions to {inputBoost:inputBoostData, inputEnableSharpening:inputEnableSharpeningData, inputBaselineExposure:inputBaselineExposureData, inputNeutralChromaticityY:inputNeutralChromaticityYData}
   set theCIFilter to current application's CIFilter's filterWithImageURL:thePath options:theOptions
   set theCIImage to (theCIFilter's valueForKey:(current application's kCIOutputImageKey))
end ciFilterRAW

on saveImageDataToTiff(inputData, outPath)
   set imageRep to current application's NSBitmapImageRep's alloc()'s initWithCIImage:inputData
   set imageData to imageRep's TIFFRepresentation()
   return imageData's writeToFile:outPath atomically:true
end saveImageDataToTiff

Last edited by Fredrik71 (2021-03-24 05:47:25 am)


if you are the expert, who will you call if its not your imagination.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)