The Flying Meat Wiki : AcornWriteBitmapLayersToTmp

HomePage :: Categories :: PageIndex :: RecentChanges :: Login/Register
Most recent edit on 2007-11-12 10:15:37 by GusMueller

Deletions:
eltzelouc4ts



Edited on 2007-11-11 20:42:57 by NoelcNamon

Additions:
eltzelouc4ts



Oldest known version of this page was edited on 2007-09-23 11:03:11 by GusMueller []
Page view:
This Python plugin will iterate through the documents' layers, and then write out each bitmap layer to /tmp as a tiff.

WriteLayersToTiff.py
import objc, os, math
from Foundation import *
from AppKit import *

ACScriptSuperMenuTitle = None
ACScriptMenuTitle = "Write out layers to tmp"

def main(image):
    doc          = NSDocumentController.sharedDocumentController().currentDocument()
    layerCount   = 0
   
    for layer in doc.layers():
   
        if layer.layerType() == 1: # bitmap layer
            ciimage = layer.CIImage()
            nsimage = ciimage.NSImage()
            
            tiffData = nsimage.TIFFRepresentation()
            
            tiffData.writeToFile_atomically_("/tmp/layer%d.tiff" % layerCount, False)
            
        layerCount = layerCount + 1
   
    # we're not changing the image, so we'll return nothing to put on
    return None




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