Updated 2024-12-05 8.21 PM
By Andrew Hazelden [email protected]
Kartascript is a Python module for immersive post-production workflow automation. It provides PTGui .pts JSON file parsing tools.
- LGPL
- Add an interactive TUI (text user interface)
- Add the following functions:
- GetOutputFilename
cd $HOME/Desktop/kartascript/
python3
import kartascript as ks
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
print(ks.Dump(pt))
import kartascript as ks
pt = ks.ReadURL("https://raw.githubusercontent.com/Kartaverse/Kartascript/refs/heads/master/Demo%20PT/Samyang_8mm_v001.pts")
print(ks.Dump(pt))
import kartascript as ks
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
lnum = ks.GetLensCount(pt)
print(lnum)
import kartascript as ks
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
inum = ks.GetImageCount(pt)
print(inum)
import kartascript as ks
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
imglist = ks.GetImageFilenameList(pt)
print(ks.Dump(imglist))
import kartascript as ks
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
img = ks.GetImageFilename(pt,0)
print(img)
import kartascript as ks
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
index = 1
print(ks.GetMaskImage(pt, index, "Demo PT/image.png"))
import kartascript as ks
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
index = 1
maskb64 = ks.GetMaskImageBase64(pt, 1)
print(maskb64)
import kartascript as ks
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
index = 0
w, h = ks.GetImageSize(pt, index)
print(w, h)
import kartascript as ks
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
index = 0
x, y, z = ks.GetRotation(pt, index)
print(x, y, z)
import kartascript as ks
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
index = 0
focallength = ks.GetFocalLength(pt, index)
print(focallength)
import kartascript as ks
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
for index in range (ks.GetImageCount(pt)):
focallength = ks.GetFocalLength(pt, index)
print(focallength)
import kartascript as ks
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
index = 0
projection = ks.GetLensProjection(pt, index)
print(projection)
import kartascript as ks
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
index = 0
a, b, c = ks.GetLensABC(pt, index)
print(a, b, c)
import kartascript as ks
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
index = 0
projection, focallength, shiftlongside, shiftshortside, hshear, vshear, a, b, c = ks.GetLenses(pt, index)
print(projection, focallength, shiftlongside, shiftshortside, hshear, vshear, a, b, c)
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
for index in range (ks.GetImageCount(pt)):
projection, focallength, shiftlongside, shiftshortside, hshear, vshear, a, b, c = ks.GetLenses(pt, index)
print(projection, focallength, shiftlongside, shiftshortside, hshear, vshear, a, b, c)
import kartascript as ks
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
csv_string = ks.GetCSVString(pt)
print(csv_string)
import kartascript as ks
pt = ks.ReadFile("Demo PT/Under the Bridge PTGui v12.pts")
print(ks.GetCSVFile(pt, "Demo PT/Under the Bridge PTGui v12.csv"))