GithubHelp home page GithubHelp logo

antoine-roux / krita-plugin-reference Goto Github PK

View Code? Open in Web Editor NEW
40.0 4.0 8.0 21 KB

A temporary Reference Docker for Krita 4.0.0

License: GNU General Public License v3.0

Python 100.00%
krita plugin reference

krita-plugin-reference's Introduction

Krita reference plugin

This is a quick and dirty plugin to replace the removed Reference Images Docker in Krita 4.0.0

A temporary solution

As said at https://krita.org/en/item/krita-4-0-0-released/, the removal is only temporary:

"The Reference Images Docker has been removed. It was too easy to crash it if invalid image files where present. In Krita 4.1 it will be replaced by a new reference images tool."

How to install

Open Krita, in Settings -> Manage Resources click on the Open Resource Folder button.

Copy-paste all files from https://github.com/antoine-roux/krita-plugin-reference/archive/master.zip in the pykrita folder

Add execution permissions to the file reference.py (stored inside the 'reference' folder).

Restart Krita.

How to enable

Enable the plugin in Settings -> Configure Krita -> Python Plugin Manager (Reference)

Check Settings -> Dockers -> Reference Docker

How to use

Load an image

Click on Open and choose an image. Beware, no verification is done on the format... You've been warned!

Move the reference and zoom

You can grab the reference to move it (with any mouse button, left/right/middle... don't care).

Use the wheel or press on Ctrl and drag up-down to zoom.

Pick a color

Just click on the wanted part of the reference, you can shift your selection by some pixels.

A color preview is displayed on the top of the Docker.

krita-plugin-reference's People

Contributors

antoine-roux avatar deevad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

krita-plugin-reference's Issues

Zoom reset when resizing the docker window

Hi there,
when the docker reference window is resized, even by one pixel, the image inside snaps back fully outzoomed, fitting this whole reference picture in.
super annoying when you just wanted to arrange the docker a bit and have to zoom all the way back in and remind yourself to never touch the docker edge again =)

Minimum size is too large.

Thanks for this plugin, very handy, but by default it is very greedy with its minimum screen real estate use. It seems to be due to line 34 in the reference.py script where you used QSizePolicy.MinimumExpanding for both axes.

Switching those to QSizePolicy.Expanding seems to remove the annoying minimum size issue and allows for the docker to be shrunk down a lot smaller than it would be possible otherwise.

blurry reference image when zoomed in

Zooming in, The image sadly gets super blurry, which is really bad for pixelart references and the like.
I can turn off canvas graphics acceleration or change filters, it doesn't matter.
(for reference there is an xnview window zoomed in to maximum,
but it zooms only to 1600%, which isn't enough, whereas your plugin zooms in way higher, which is great.
Krita_Pixel_layout

[krita 5.2beta1] Error at loading

Hi,
In the new beta of Krita (5.2beta1, appimage), the plugin display a message of error at loading (at the same time of the splash screen). The message looks like this:

2023-08-05_screenshot_164250_net

And the inner part of the dialog I can copy/paste is:

TypeError
Python 3.10.7: /usr/bin/python3
Sat Aug  5 16:41:54 2023

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

 /tmp/.mount_krita-GwEhQQ/usr/lib/krita-python-libs/krita/dockwidgetfactory.py in createDockWidget(self=<krita.dockwidgetfactory.DockWidgetFactory object>)
   14         super(DockWidgetFactory, self).__init__(_id, _dockPosition)
   15         self.klass = _klass
   16 
   17     def createDockWidget(self):
   18         return self.klass()
self = <krita.dockwidgetfactory.DockWidgetFactory object>
self.klass = <class 'reference.reference.ReferenceDocker'>

 /home/deevad/.local/share/krita/pykrita/reference/reference.py in __init__(self=<reference.reference.ReferenceDocker object>)
  173         fileName = Application.readSetting('referenceDocker', 'lastref', None)
  174         if fileName is not None:
  175             self.viewer.setImage(QImage(fileName))
  176 
  177     def centerView(self):
self = <reference.reference.ReferenceDocker object>
self.viewer = <reference.reference.ReferenceViewer object>
self.viewer.setImage = <bound method ReferenceViewer.setImage of <reference.reference.ReferenceViewer object>>
global QImage = <class 'PyQt5.QtGui.QImage'>
fileName = '/home/deevad/references/palettes/00_palette-PC_ep38.png'

 /home/deevad/.local/share/krita/pykrita/reference/reference.py in setImage(self=<reference.reference.ReferenceViewer object>, image=<PyQt5.QtGui.QImage object>)
   55     def setImage(self, image=QImage()):
   56         self.image = image
   57         self.resetView()
   58 
   59     def resetView(self):
self = <reference.reference.ReferenceViewer object>
self.resetView = <bound method ReferenceViewer.resetView of <reference.reference.ReferenceViewer object>>

 /home/deevad/.local/share/krita/pykrita/reference/reference.py in resetView(self=<reference.reference.ReferenceViewer object>)
   64                         self.size().height() / self.image.size().height())
   65         overflow = self.size() - (self.image.size() * self.zoom)
   66         self.origin = QPoint(overflow.width() / 2, overflow.height() / 2)
   67         self.update()
   68 
self = <reference.reference.ReferenceViewer object>
self.origin = PyQt5.QtCore.QPoint()
global QPoint = <class 'PyQt5.QtCore.QPoint'>
overflow = PyQt5.QtCore.QSize(407, 0)
overflow.width = <built-in method width of QSize object>
overflow.height = <built-in method height of QSize object>
TypeError: arguments did not match any overloaded call:
  QPoint(): too many arguments
  QPoint(int, int): argument 1 has unexpected type 'float'
  QPoint(QPoint): argument 1 has unexpected type 'float'
    __cause__ = None
    __class__ = <class 'TypeError'>
    __context__ = None
    __delattr__ = <method-wrapper '__delattr__' of TypeError object>
    __dict__ = {}
    __dir__ = <built-in method __dir__ of TypeError object>
    __doc__ = 'Inappropriate argument type.'
    __eq__ = <method-wrapper '__eq__' of TypeError object>
    __format__ = <built-in method __format__ of TypeError object>
    __ge__ = <method-wrapper '__ge__' of TypeError object>
    __getattribute__ = <method-wrapper '__getattribute__' of TypeError object>
    __gt__ = <method-wrapper '__gt__' of TypeError object>
    __hash__ = <method-wrapper '__hash__' of TypeError object>
    __init__ = <method-wrapper '__init__' of TypeError object>
    __init_subclass__ = <built-in method __init_subclass__ of type object>
    __le__ = <method-wrapper '__le__' of TypeError object>
    __lt__ = <method-wrapper '__lt__' of TypeError object>
    __ne__ = <method-wrapper '__ne__' of TypeError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of TypeError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of TypeError object>
    __repr__ = <method-wrapper '__repr__' of TypeError object>
    __setattr__ = <method-wrapper '__setattr__' of TypeError object>
    __setstate__ = <built-in method __setstate__ of TypeError object>
    __sizeof__ = <built-in method __sizeof__ of TypeError object>
    __str__ = <method-wrapper '__str__' of TypeError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __suppress_context__ = False
    __traceback__ = <traceback object>
    args = ("arguments did not match any overloaded call:\n  Q...t(QPoint): argument 1 has unexpected type 'float'",)
    with_traceback = <built-in method with_traceback of TypeError object>

The above is a description of an error in a Python program.  Here is
the original traceback:

Traceback (most recent call last):
  File "/tmp/.mount_krita-GwEhQQ/usr/lib/krita-python-libs/krita/dockwidgetfactory.py", line 18, in createDockWidget
    return self.klass()
  File "/home/deevad/.local/share/krita/pykrita/reference/reference.py", line 175, in __init__
    self.viewer.setImage(QImage(fileName))
  File "/home/deevad/.local/share/krita/pykrita/reference/reference.py", line 57, in setImage
    self.resetView()
  File "/home/deevad/.local/share/krita/pykrita/reference/reference.py", line 66, in resetView
    self.origin = QPoint(overflow.width() / 2, overflow.height() / 2)
TypeError: arguments did not match any overloaded call:
  QPoint(): too many arguments
  QPoint(int, int): argument 1 has unexpected type 'float'
  QPoint(QPoint): argument 1 has unexpected type 'float'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.