Skip to content

Instantly share code, notes, and snippets.

View KelSolaar's full-sized avatar
🔅
Bending Light

Thomas Mansencal KelSolaar

🔅
Bending Light
View GitHub Profile
@KelSolaar
KelSolaar / autocrop.py
Created May 7, 2013 09:58
Nuke - Autocrop
def getCropRectangle(node):
width, height = node.width(), node.height()
xMin = width
xMax = 0
yMin = height
yMax = 0
for x in range(width):
for y in range(height):
if node.sample("alpha", x, y) != 0:
@KelSolaar
KelSolaar / setPulldownChoiceExpression.py
Created June 4, 2013 21:09
Nuke - Set Pulldown Choice Expression
knob = nuke.toNode("Camera_Color_Profiling.cameraColorProfiling_ColorMatrix").knob("outputColorSpace_pulldownChoice")
knob.setExpression("parent.outputColorSpace_pulldownChoice", 0)
@KelSolaar
KelSolaar / acr_Cr2GeneratedSidecarXMP.xml
Last active December 19, 2015 22:28
ACR - CR2 Generated Sidecar XMP
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.5-c002 1.148022, 2012/07/15-18:06:45 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
xmlns:exif="http://ns.adobe.com/exif/1.0/"
xmlns:aux="http://ns.adobe.com/exif/1.0/aux/"
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#"
@KelSolaar
KelSolaar / dngc_EmbededDNGXMP.xml
Last active December 19, 2015 22:29
DNGC - Embeded DNG XMP
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.5-c002 1.148022, 2012/07/15-18:06:45 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:aux="http://ns.adobe.com/exif/1.0/aux/"
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#"
xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#"
@KelSolaar
KelSolaar / dngc_EmbededDNGXMP_acrEdition.xml
Created July 18, 2013 07:38
DNGC - Embeded DNG XMP - ACR Edition
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.5-c002 1.148022, 2012/07/15-18:06:45 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:aux="http://ns.adobe.com/exif/1.0/aux/"
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#"
xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#"
@KelSolaar
KelSolaar / linearRamp.py
Created September 29, 2013 13:15
PIL - Simple Linear Ramp
from PIL import Image
width, height = 256, 32
image = Image.new("RGB", (width, height))
pixels = image.load()
for i in range(image.size[0]):
for j in range(image.size[1]):
pixels[i,j] = (i, i, i)
image.save("Linear_Ramp.png", "PNG")
@KelSolaar
KelSolaar / revertBlendshapesMask.mel
Last active December 26, 2015 03:09
Maya - Revert Blendshapes Mask
artAttrInitPaintableAttr;
artBlendShapeTargetIndex;
artAttrBlendShapeValues artAttrBlendShapeContext;
artAttrUpdatePaintValueSlider artAttrCtx;
artAttrBlendShapeValues artAttrBlendShapeContext;
artAttrPaintOperation artAttrCtx Scale;
artAttrBlendShapeValues artAttrBlendShapeContext;
artAttrCtx -e -value -1.0 `currentCtx`;
artAttrCtx -e -clear `currentCtx`;
artAttrPaintOperation artAttrCtx Add;
@KelSolaar
KelSolaar / fovCalculator.py
Created March 2, 2014 21:09
FOV Calculator
import math
diagonal = lambda w, h: math.sqrt(w ** 2 + h ** 2)
wr = 36. # Reference 24mm * 36mm sensor.
hr = 24.
dr = diagonal(wr, hr)
w = 7.6 # Current sensor: http://en.wikipedia.org/wiki/Image_sensor_format
h = 5.7
@KelSolaar
KelSolaar / ansiColors.py
Last active August 29, 2015 13:57
ANSI Colors
BACKGROUND_CODES = (("bBlack", "40m"),
("bRed", "41m"),
("bGreen", "42m"),
("bYellow", "43m"),
("bBlue", "44m"),
("bPurple", "45m"),
("bCyan", "46m"),
("bWhite", "47m"),
("bHighBlack", "100m"),
("bHighRed", "101m"),
@KelSolaar
KelSolaar / for_JetBrains.py
Last active August 29, 2015 14:05
Stuff to discuss with JetBrains
# PyCharm will complain the the parameters are missing in docstrings with
# Numpy style docstrings.
def XYZ_to_CIECAM02(XYZ,
XYZw,
LA,
Yb,
surround=CIECAM02_VIEWING_CONDITIONS.get(
'Average'),
discount_illuminant=False):
"""