The Flying Meat Wiki : AcornMakeGrayscalePlugin

HomePage :: Categories :: PageIndex :: RecentChanges :: Login/Register
Most recent edit on 2007-11-10 23:20:24 by GusMueller

Deletions:
vilicer



Edited on 2007-11-10 21:53:45 by ErrolCadom

Additions:
vilicer



Edited on 2007-11-10 18:15:16 by GusMueller

Deletions:
bocdarcotro



Edited on 2007-11-10 14:39:07 by AcvarBocac

Additions:
bocdarcotro



Oldest known version of this page was edited on 2007-09-11 18:34:41 by GusMueller []
Page view:
And here is an example which takes the current bitmap layer and converts it to grayscale using CoreImage. It also setups a keyboard shortcut, using Control-Command-G:

MakeGrayscale.py
import objc

ACScriptSuperMenuTitle = "Color"
ACScriptMenuTitle = "Make Grayscale (python)"
ACShortcutKey = 'g'
ACShortcutMask = "command control"

CIColor  = objc.lookUpClass('CIColor')
CIFilter = objc.lookUpClass('CIFilter')

def main(image):
   
    color = CIColor.colorWithRed_green_blue_(0.5, 0.5, 0.5)
   
    filter = CIFilter.filterWithName_('CIColorMonochrome')
    filter.setDefaults()
   
    filter.setValue_forKey_(image, 'inputImage')
    filter.setValue_forKey_(color, 'inputColor')
    filter.setValue_forKey_(1, 'inputIntensity')
   
    return filter.valueForKey_('outputImage')




Back to AcornPlugins
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.3
Page was generated in 0.0852 seconds