Krita Scripting

  1. Pages
    1. index
  2. Objects
    1. Scripting::Brush
    2. Scripting::Color
    3. Scripting::ConstIterator
    4. Scripting::ConstIteratorBase
    5. Scripting::ConstPaintDevice
    6. Scripting::Filter
    7. Scripting::Histogram
    8. Scripting::Image
    9. Scripting::Iterator
    10. Scripting::IteratorBase
    11. KisProgressSubject
    12. KoScriptingModule
    13. Scripting::Module
    14. Scripting::Module::Private
    15. Scripting::Monitor
    16. Scripting::PaintDevice
    17. Scripting::Painter
    18. Scripting::PaintLayer
    19. Scripting::Pattern
    20. Scripting::Progress
    21. Scripting::Wavelet

index

In Krita, you can write scripts in Ruby or Python (the availability of the interpreters might depend on what your distributions or the administrator of your machine did install). Here you will find a description of the scripting API.

Handbook

Krita offers a complete handbook which includes detailed informations about the scripting API, examples and more.

http://www.koffice.org/krita

http://docs.kde.org/development/en/koffice/krita/

Objects

The Scripting::Module is the Krita scripting module which provides access to the scripting functionality.

Examples

Some examples are distributed with Krita, and you might find them in /usr/share/apps/krita/scripts (or /opt/kde/share/apps/krita/scripts depending on your used distribution).

Also you are able to get or even provide your own new scripts online at

http://www.kde-files.org/index.php?xcontentmode=616

Objects

Scripting::Brush

A brush object.


Scripting::Color

The color class represents a single color.


Scripting::ConstIterator


Scripting::ConstIteratorBase

This object allow to read the value of pixel one by one.


Scripting::ConstPaintDevice

A PaintDevice is a layer within a Image where you are able to perform paint-operations on.


Scripting::Filter

This class enables access to the filters Krita provides.

For example (in Ruby)

 require "Krita"

 # fetch the image.
 image = Krita.image()

 # we like to operate on the active painting layer.
 layer = image.activePaintLayer()

 # get the height and the width the layer has.
 width = layer.width()
 height = layer.height()

 # we like to use the progressbar
 progress = Krita.progress()
 progress.setProgressTotalSteps( (width / 20) * (height / 20) )

 # apply the invert filter each 20x20 pixels at a 10x10 rect.
 invertfilter = Krita.filter("invert")
 0.step(width - 10, 20) do |x|
     0.step(height - 10, 20) do |y|
         invertfilter.process(layer, x, y, x + 10, y + 10)
         progress.incProgress()
     end
 end


Scripting::Histogram

This class allow to access the histogram of a PaintDevice object.

Example (in Ruby) :

 require "Krita"
 image = Krita.image()
 layer = image.activePaintDevice()
 histo = layer.createHistogram("RGB8HISTO",0)
 min = histo.min() * 255
 max = histo.max() * 255
 for i in min..max
     print layer.getValue(i), "\n"
 end


Scripting::Image

An image object.


Scripting::Iterator


Scripting::IteratorBase

This object allow to change the value of pixel one by one.


KisProgressSubject


KoScriptingModule


Scripting::Module

The main Module class enables access to the Krita functionality from within the supported Kross scripting backends like for example Python or Ruby.


Scripting::Module::Private


Scripting::Monitor


Scripting::PaintDevice

A PaintDevice is a layer within a Image where you are able to perform paint-operations on.


Scripting::Painter

The painter enables drawing to a PaintDevice object.


Scripting::PaintLayer

A paintlayer is a layer within a Image where you are able to perform paint-operations on.


Scripting::Pattern

Pattern object.


Scripting::Progress

The Progress object enables displaying of a progressbar in Krita to visualize the progress your script makes.


Scripting::Wavelet

Fast Wavelet object.