saveImage

saveImage.py

Hi nuker's finally found a solution for our long time wish and expectation. Now you can save image from the viewer. Like eyeon fusion and other application.

saveImage.py will allowing you to choose the path and file name and type. Now you can choose the image as any format (which ever nuke support). example jpg, tga, tiff, png et.

Added extra future channels. user can select channels to save image.

Added extra future while saving as exr you can choose the Data type. Default its in 16bit-half, either you can choose32-bit float. Fixed sub-sampling to 4:4:4 while save as .jpg.

Go to active viewer and right click select the save image as. It will pop-up a window like below image.




Choose your path and file type.


Hit ok it will save your active viewer result as image, It creates a read node and import your saved image into nuke.





If you forget to choose path and file type nuke will pop-up a message box like below image:


Hope this will help you Nuker's.

copy paste the following line to your menu.py.

nuke.menu( 'Viewer' ).addCommand( 'save image as', "saveImage.saveImage()")

Download from: nukepedia
Download from: skydrive


Add this script into your custom .nuke DIR as saveImage.py:

'''
Created on 19-jan-2013
Updated on 2 april 2016
@author: satheesh-R
mail - satheesrev@gmail.com
'''

import nuke, nukescripts
def saveImage ():

    ### Getting Lut list from root
    LutList = [n.split(" ")[0] for n in nuke.root()['luts'].toScript().split("\n")]
    Luts = '\n'.join(LutList)

    ### creating panel and assign buttons
    ef = nuke.Panel("saveImage As......  by satheesh-r", 420)
    ef.addFilenameSearch("Save Image As:\nchoose path & file type", "")
    ef.addButton("cancel")
    ef.addEnumerationPulldown('channels', "rgb rgba all")
    ef.addEnumerationPulldown('Color Space', Luts)
    ef.addEnumerationPulldown('Exr data type', "16bit-half 32bit-float")
    ef.addButton("ok")
    window=ef.show()

    ### getting values from panel
    exrtype = ef.value('Exr data type')
    channel = ef.value('channels')
    path = ef.value("Save Image As:\nchoose path & file type")
    colorSpace = ef.value('Color Space')
    fileType = path.split('.')[-1]

    ### User cancel the oparation
    if window == 0 :
        return

    ### if file format not found
    fileFormat = path.split('/')[-1]
    findDot = ('.')
    for dot in findDot:
        if dot in fileFormat:
            if dot == '.':
           
                ### getting path from user input
                if path == "":
                    nuke.message('no file path selected ')
                if path == "":
                    return
           
                ### getting active node
                curViewer = nuke.activeViewer()
                curNode = curViewer.node()
                acticeVinput = curViewer.activeInput()
                curN = curNode.input(acticeVinput)
           
                ### creating temp write
                w = nuke.createNode("Write")
                w.setName("tempWrite")
                w.setInput(0, curN)
                w['file'].setValue(path)
                w['colorspace'].setValue(colorSpace)
                w['channels'].setValue(channel)
           
                ### if file type is jpg
                if fileType == 'jpg' :
                    w['_jpeg_sub_sampling'].setValue(2)
                    w['_jpeg_quality'].setValue(1)
           
                ### if file type is exr
                if fileType == 'exr' :
                    w['datatype'].setValue(exrtype)
                    w['compression'].setValue(2)
                    w['metadata'].setValue(0)
           
                ### setting current frame for render
                curFrame = nuke.frame()
                if curFrame =="":
                  curFrame = curFrame
           
                ### execute write node
                nuke.execute(nuke.selectedNode(), (int(curFrame)), curFrame)
                name = w.knob('file').value()
                nukescripts.node_delete(popupOnError=True)
           
                ### create Read node
                r = nuke.createNode("Read")
                r['file'].setValue(name)
                curFrame = nuke.frame()
                r['first'].setValue(int(curFrame))
                r['last'].setValue(int(curFrame))
        else:
            nuke.message('forget to choose file format')
            return

Popular posts from this blog

2D Volumetric rays in nuke

Nuke workFlow optimisation TIPS

Export Maya camera and Objects to Nuke