Sign in to follow this  
Followers 0
Martin Osieka

'Color Matrix' Adjustment Plugin

8 posts in this topic


'Color Matrix' Adjustment Plugin

Summary

Adjusts all individual pixels in the selected area of the active layer using a color transformation matrix.

 

ColorMatrix.Effect.Dialog.jpg

 

The plugin contains a set of predefined matrices to manipulate the individual RGBA channels, adapt transparency or to simulate the effect of different color blindness defects. Changing the matrix will show 'User defined' in the preset selector. Here the list of presets:

    Identity - Does nothing
    RGB (solid) - Sets the alpha channel to solid
    RGB (inverted) - Inverts the RGB channels and keeps alpha
    RGB to Gray - Converts RGB to gray and keeps alpha
    RGB to Gray (inverted)
    RGB to Transparency
    RGB to Transparency (inverted)
    RGB to BGR (or back)
    RGB to Sepia
    Red to Gray (solid)
    Red only (solid)
    Green to Gray (solid)
    Green only (solid)
    Blue to Gray (solid)
    Blue only (solid)
    Transparency to Gray (solid)
    Transparency to Gray (solid, inverted)
    Transparency only
    Cyan only (solid)
    Magenta only (solid)
    Yellow only (solid)
    Red-Blind (Protanopia)
    Red-Weak (Protanomaly)
    Green-Blind (Deuteranopia)
    Green-Weak (Deuteranomaly)
    Blue-Blind (Tritanopia)
    Blue-Weak (Tritanomaly)
    Monochromacy (Achromatopsia)
    Weak Monochromacy (Achromatomaly)

How does it work? The following formula is applied to each pixel:
 (R,G,B,A,255) = (((R,G,B,A,255) / 255) * matrix) * 255
Result values <0 or >255 are clamped.
The render code is simple because it just provides the image and the matrix to
Windows GDI+.

Keywords

Adjustment, Color matrix, Color blindness

Author

Martin Osieka

Download

Find the latest version of the plugin ColorMatrix v1.1 (25.6.2015) here

Installation

Follow the instructions carefully

  • Unzip "ColorMatrix.Effect vX.X.zip"
  • Copy the two files ColorMatrix.Effect.dll/.dlc to the Paint.NET\Effects\ folder
    A typical location is "C:\Program Files\Paint.NET\Effects".
    .dll contains the module code
    .dlc contains the module configuration (like translated text)
  • Copy the two files OptionBasedLibrary vX.X.dll/.dlc to the Paint.NET\ folder (not to the Effects folder!)
    A typical location is "C:\Program Files\Paint.NET".
  • After a restart of Paint.NET you will find the plugin at
      Menu->Adjustments->Color Matrix...
    oder für deutsche Anwender unter
      Menü->Korrekturen->Farbmatrix..

Compatibility

Paint.NET 3.5.11 and 4.0.5

Supported languages

The language used in the plugin depends on the language setting of Paint.NET and the support of this language by the plugin. The fallback is the first supported language of the plugin. Languages are defined in the .dlc files. This plugin supports the following languages in the moment:

  • English
  • Deutsch

You may add your own translation to the .dlc file.

Known issues

None

Example

Using the matrix preset "RGB inverted"

    -1  0  0  0  0
     0 -1  0  0  0
     0  0 -1  0  0
     0  0  0  1  0
     1  1  1  0  1

Applying the formula

    R' = R/255; G' = G/255; B' = B/255; A' = A/255
    R" = R' * -1 + G' *  0 + B' *  0 + A' * 0 + 1 = 1 - R'
    G" = R' *  0 + G' * -1 + B' *  0 + A' * 0 + 1 = 1 - G'
    B" = R' *  0 + G' *  0 + B' * -1 + A' * 0 + 1 = 1 - B'
    A" = R' *  0 + G' *  0 + B' *  0 + A' * 1 + 0 = A'
    R = R"*255; G = G"*255; B = B"*255; A = A"*255

History

  • 1.1 (25.6.2015)
    - Added 'RGB (solid)' entry to set the alpha channel to opaque
    - Added column titles
    - Renamed the dll file. You have to remove the old ColorMatrix.dll/.dlc file
    - Updated OptionBasedLibrary
  • 1.0 (16.5.2015)
    - First release

 

Edited by Martin Osieka
4

Share this post


Link to post
Share on other sites

I'm liking this Martin!

It sounds complex, but with the presets it's a breeze to use and modify. An example - I recolored this image to make the knight look bronzed. Neat!

yhsjjie-165.png

0

Share this post


Link to post
Share on other sites

Because setting the alpha channel of the selection to opaque is not an unusual operation, I added a preset for this to the dialog and did some clean-up.

 

Update: 1.1 (25.6.2015)
- Added 'RGB (solid)' entry to set the alpha channel to opaque
- Added column titles
- Renamed the dll file. You have to remove the old ColorMatrix.dll/.dlc file !!!
- Updated OptionBasedLibrary
 

1

Share this post


Link to post
Share on other sites

 

 

Thank you so much for the plugin and for your effort. 8omy7494.gif

0

Share this post


Link to post
Share on other sites

Nice one, kinda like Channel Mixer in PhotoShop. Although sliders would be more intuitive.

 

QpAiE0b.jpg

 

PxGhNIO.jpg

0

Share this post


Link to post
Share on other sites

What the hell happened with the Cancel button? ;-)

Sorry for some reason OptionBasedLibrary 0.7.9 moved the button out of the dialog window. This happened a while ago but nobody complained ;-) So we have to update some tools like 'Parallel Lines and Pattern', 'Color Harmonies'...

 

Back to topic. Thanks for the replies. Maybe an additional explanation:

 

There are two basic internal operations used in image processing. One is the 'Color Matrix' used to manipulate single pixels and second the 'Convolution Matrix' used to build filters like emboss. Typically a user can not access these matrices because no one likes to think about the math to reach a certain effect. So providing such plugins is just to offer people the possibility to play on this level (a basic kind of programming) and maybe to understand what's going on in the background.

 

racerx pointed to Channel Mixer. This PhotoShop tool is already one level above and a little bit more restricted. But for sure easier to use. There is an advanced channel mixer plugin here. I'm not sure if it is much easier to handle like Color Matrix. But there are sliders ;-)

0

Share this post


Link to post
Share on other sites

Yes indeed Color Matrix is very advanced. Lot's of latitude for color channel adjustments. The more I play around with it, the better I like it.

 

Though not very scientific, here is a very quick simulation of Original vs Curves + vs Color Matrix.  

 

o7EQ4Zo.gif

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0