Skip to content

sGaps/pixel-borders

Repository files navigation

banner

Pixel Borders

A plugin that helps you to make pixel-art quicker. This uses uses Krita's Python API, PyQt5 and Python's built-in modules to make borders for your pixel-art characters.

Pixel Borders performs several operations to make this task easier, and it works on paint layers and group layers, even if these have key-frames on the timeline.

Content Table

Introduction

Sometimes, when I'm drawing a pixel-art animation, I try to add borders to the characters in the scene to get a nice videogame style. These look very nice but They're hard to do when There's a lot of key-frames and layers linked to a single character.

It takes over 3 hours to complete this effect manually on a small-sized animation. That's boring and error prone: I remember I had to make the effect from start when I forgot a single step on the frame 50 of an animation with 200 key frames on its timeline!

That was one of many reasons why I started this project. It was a simple script at begining, but I wasn't satisfied with it: it was slow and didn't work very well on animated layers, so I keep working on it, fixing its flaws at first glance. Then I added a GUI to use it in a more comfortable way, also its core was improved and... The rest of this tale is on the commits of this repository.

- I just took that idea and made it comfortable to use. -

With Pixel Borders you can add borders of 1px width, or make a smoother one adding more steps into the border recipe. Maybe, you could Add colors to the corners of a character or even make a kind of fractal as a border.

Pixel Borders has been developed among several months in my free time and now, It's finally available here!

Go Top

An example

No Borders Borders Recipe
SGuy-a SGuy-b any-neighbor:1 + corners:1 + any-neighbor:1

Features

  • This plugin uses Krita's Python API and some facilities provided by PyQt5 package to perform its tasks, so there's no need to install another python package for Krita.

  • Also, it's compatible with dark and light themes.

  • Undo actions are supported since Krita 4.4.x

  • It includes some methods to make recipes for the new borders which can be used on the quick mode and custom mode:

    • any-neighbor: The pixel becomes opaque when there's at least one opaque pixel next to it.

    • corners: The pixel becomes opaque if it has one vertical and one horizontal opaque neighbor.

    • force: same as any-neighbor but faster.

    • not-corners: Complement of corners method. Useful to make rough borders.

    • strict-horizontal: The pixel becomes opaque if it has only horizontal opaque neighbors.

    • strict-vertical: The pixel becomes opaque if it has only vertical opaque neighbors.

Method Result
None None
any-neighbor Any-Neighbor
corners Corners
not-corners Not-Corners
strict-horizontal Strict-Horizontal
strict-vertical Strict-Vertical

Improve your workflow

Play with the different results that can be obtained using Pixel Borders. See how quick this will be achieved with it.

Click the Use Previous recipe button to repeat the last recipe used.

Group Layers?

Yes, it works with them. Select the Group layer, and use this plugin just like a normal filter being used on a paint layer.

Animated Layers?

Yes, it works on regular animated layers and on group layers with animated layers inside.

Limitations

Unfortunely, this doesn't work well with:

  • Filter masks that modify the bounding box of their parent layer.

That's because these special layers doesn't provide any updated values of their parent's bounding box. It will be necessary scan the whole canvas to known exactly how that bound is, and it drops down the efficiency reached by using the current pixel_borders.core.

If the filter mask doesn't modify the bounds of its parent layer, Pixel Border will work fine with it.

Go Top

How to Use it

In Krita:

  1. Click on tools > Scripting > Pixel Borders.
  2. Write a name for the new Border.
  3. Choose the Foreground or the Background color currently used.
  4. Choose between the quick mode and the custom mode.
  5. Fill out the remaining information.
  6. Wait until The new border is done.
  7. Press Ok.

Quick Way

Quick mode has been chosen. Useful to get a simple border.

Select the method this plugin will use, then press the number next to it and set the width of the new border.

Custom Border

Custom mode has been chosen. Make complex recipes with it.

There will be a single method, click on it to select another and then press the number next to it and set the width.

Buttons Description
Add Press to add a new method at bottom.
Remove Press to remove the method at bottom.
Clear Press to delete all the methods except the first one.

Even Quicker Way

Previous Border button has been pressed.

It repeats the previous recipe, applying it on the current selected Layer. If that Layer has key-frames, it will make animated borders.

Useful Recipes

Name How to do it
Classic Borders Quick mode + any-neighbor:1
Smooth Borders Custom mode + any-neighbor:1 + corners:1 + any-neighbor:1
Rough borders Custom mode + any-neighbor:1 + not-corners:1
Fuzzy Quick mode + not-corners:5 or greater
Vertical explosion Quick mode + strict-vertical:10 or greater
Horizontal explosion Quick mode + strict-horizontal:10 or greater

Go Top

Get the plugin!

Krita uses a specific folder to load its Plugins. It is pykrita/ and it's in the folder ~/.local/share/krita/ on Linux, and %appdata%\krita\ on Windows.

Download with Git

  1. Open a terminal.
  2. Go to your pykrita/ folder.
  3. Clone this repository (I recommend to use the lastest release).
git clone https://github.com/sGaps/pixel-borders.git pixel-borders/
  1. Copy the .desktop file from pykrita/pixel-borders/ to pykrita/.
cp pixel-borders/pixel-borders.desktop pixel-borders.desktop

Download as zip

  1. Go to the release snippet of this repository.
  2. Download the lastest compressed file (.tar.gz, or .zip)
  3. Extract the folder inside the zip(named pixel-borders*) to your pykrita/ folder.
  4. Rename the new folder as pixel-borders.
  5. Copy the file pixel-border.desktop from pykrita/pixel-borders/ to pykrita/.

After following the previous steps, the folder hierarchy should look like this:

PluginInstalled

Go Top

Enable it on Krita!

After Get the Plugin:

  1. Open Krita.
  2. Go to Settings > Configure Krita > Python Plugin Manager
  3. Search the row Pixel Borders by Gaps on the list at right.
  4. Check its box and restart Krita.

System Requirements

Minimum (tested) Recomended
Krita 4.3.0 Krita 4.4.x
Python 3.6 Python 3.9
PyQt5 5.12.x PyQt5 5.15.x

Tested on

CPU RAM Krita HDD Speed
Pentium IV + 1.7 GiB 4.3.0, 4.4.2 7200 RPM
i3 * 2.0 GiB 4.4.2 5200 RPM
Detailed CPU Info
+ Intel Pentium IV 630 HT (3.0 Ghz)
* Intel i3 380M (2.53 Ghz)

Go Top

Social Media

Gaps | sGaps | ArtGaps