Initial commit

This commit is contained in:
Daniel Lynn 2022-04-02 22:36:21 -05:00
commit 98f3cb2330
Signed by: daniel
GPG Key ID: 28496A140E180A9D
4 changed files with 74 additions and 0 deletions

8
comicify.desktop Normal file
View File

@ -0,0 +1,8 @@
[Desktop Entry]
Type=Service
ServiceTypes=Krita/PythonPlugin
X-KDE-Library=comicify
X-Python-2-Compatible=false
X-Krita-Manual=Manual.html
Name=Comicify
Comment=Turn a photo into a comic panel

16
comicify/Manual.html Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<!--BBD's Krita Script Starter, Feb 2018 -->
<head><title>comicify</title>
</head>
<body>
<h3>comicify</h3>
Tell people about what your script does here.
This is an html document so you can format it with html tags.
<h3>Usage</h3>
Tell people how to use your script here.
</body>
</html>

7
comicify/__init__.py Normal file
View File

@ -0,0 +1,7 @@
from .comicify import Comicify
# And add the extension to Krita's list of extensions:
app = Krita.instance()
# Instantiate your class:
extension = Comicify(parent = app)
app.addExtension(extension)

43
comicify/comicify.py Normal file
View File

@ -0,0 +1,43 @@
from krita import Krita, Extension
import gmic
EXTENSION_ID = 'pykrita_comicify'
MENU_ENTRY = 'Comicify'
class Comicify(Extension):
def __init__(self, parent):
# Always initialise the superclass.
# This is necessary to create the underlying C++ object
super().__init__(parent)
def setup(self):
pass
def createActions(self, window):
action = window.createAction(EXTENSION_ID, MENU_ENTRY, "tools/scripts")
# parameter 1 = the name that Krita uses to identify the action
# parameter 2 = the text to be added to the menu entry for this script
# parameter 3 = location of menu entry
action.triggered.connect(self.action_triggered)
def action_triggered(self):
print(dir(gmic))
app = Krita.instance()
doc = app.activeDoc()
sourceLayer = doc.activeNode()
sourceLayer.setName("original")
bounds = sourceLayer.bounds()
width = bounds.width()
height = bounds.height()
# Duplicate active layer
sketchLayer = sourceLayer.duplicate()
sketchLayer.setName("sketch")
sketchData = sketchLayer.pixelData(0, 0, width, height)
# Add the extension to Krita's list of extensions:
Krita.instance().addExtension(Comicify(Krita.instance()))