Lord-KA / ESL-PyPlug

Python plugin-adapter for standart ESL Photoshop

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ESL-PyPlug

ESL standard python adapter

This lib can be added to Plugins directory of your ESL c++ standard Photoshop application to provide a way to use python-written plugins.

This is a plug-in with ML-based algorithm that modifies picture with an according style

Building

mkdir build
cd build 
cmake ..
make -j

User usage

Copy libpyplug.so to Plugins dir of your Photoshop. Add python plugins to PythonPlugins dir. Enjoy.

Dev usage

Basically, libpyplug expects your python plugin to have the same interface as ESL c++ plugin, meaning the following:

  1. implement plugin class with getTexture(), apply(), buildSetupWidgets() functions
  2. add global init_module() function with setToolBarSize() and addTool() calls

You can use the same API as ESL c++ standard, with minor differences:

  1. getPicture()/setPicture() handles 3d numpy arrays instead of class Picture

For more info see examples.

MIPT Task (compare performance of optimised and non-optimised version)

booba::Picture

The main idea of get/setPicture() functions is to lower the number of get/setPixel() calls when the whole image or some substantial part of it is modified, thus it must be fast. This means we need to lower the number of copy by using c++ move semantics. This is done in main version of ESL standard, while the special faulty version avoids use of move semantics. For the test we use a plugin that intentionally uses get/setPicture() in a wrong way, by getting the whole image and modifying a few pixels in it. The image that was modified is 1200x750 pixels.

It took around 13 seconds for optimised version to do 10 get/setPicure() calls and 19 seconds for non-optimised one in 3 runs. Thus, the difference is 30% in this demo test case.

About

Python plugin-adapter for standart ESL Photoshop


Languages

Language:Python 48.0%Language:C++ 46.7%Language:CMake 5.2%