Martin Osieka

'Color Matrix' Adjustment Plugin

Recommended Posts

 

'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 Ego Eram Reputo
Adjusted spacing of table
  • Upvote 4

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
 

  • Upvote 1

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 ;-)

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

Share this post


Link to post
Share on other sites

Version 1.0 fails to load in 4.2.10.

It provides this error

Spoiler

C:\Program Files\paint.net\Effects\ColorMatrix.dll, version 1.0.0.0

System.IO.FileNotFoundException: Could not load file or assembly 'OptionBasedLibrary v0.5, Version=0.5.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'OptionBasedLibrary v0.5, Version=0.5.0.0, Culture=neutral, PublicKeyToken=null'

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
 

 

Share this post


Link to post
Share on other sites
On 11/14/2013 at 11:18 AM, Martin Osieka said:

Copy the two files ColorMatrix.Effect.dll/.dlc to the Paint.NET\Effects\ folder

I think this the reason. Your ZIP file only contains the DLL. Not the DLC

Option based libraries are covered from other plugins I have.

 

Share this post


Link to post
Share on other sites

ColorMatrix.Effect.ReadMe.txt, ColorMatrix.Effect.dlc, and ColorMatrix.Effect.dll can be downloaded from a listing from here:
 

<snip>

 

BTW:
The .dll file in the .zip archive DropBox link by EER is named 'ColorMatrix.dll' instead of 'ColorMatrix.Effect.dll'
The .dll file at the GitHub link has the correct name, but does not show up under the Adjustments Menu after it is installed.

 

"Strange days, indeed!"

Edited by Ego Eram Reputo
to add more nfo / correcting errors

Share this post


Link to post
Share on other sites

Except that the GitHub site is another rip-off merchant who is illegally redistributing plugins.

 

Quote

@Moshyfawn

You are illegally bundling and redistributing paint.net plugins. You do not have permission to do this. You have several of my own plugins listed.

 

I am formally requesting you REMOVE your /Effects repo as per GitHub's advice here: https://help.github.com/en/github/site-policy/guide-to-submitting-a-dmca-takedown-notice.

 

If you remove the repo no further action will be taken.

 

  • Like 1

Share this post


Link to post
Share on other sites

I am sorry about that EER!
Thanks for the heads-up!

 

BTW:
I have seen several forum members, including moderators, give reverence and links to the GitHub; including your self.
I thought it was legit.

Edited by HyReZ

Share this post


Link to post
Share on other sites

GitHub provides a platform for programmers to build effects collaboratively. Most allow redistribution. some do not. In this case @Moshyfan did not.

 

  • Like 1

Share this post


Link to post
Share on other sites

This Moshyfawn idiot is redistributing without permission.☹️

 

He (I assume the user is male), is redistributing my own effects. I have just downloaded one (Aardvark).
It appears to be virus free and the same size as the original but I cannot be sure.

 

However that's not the point!

He is not collaborating and not creating anything - just stealing!


@AndrewDavid & HyRez - if I take something of yours and redistribute it without your permission or knowledge how would you feel?

Let's hope E.E.R's notice will change things.

  • Like 1

Share this post


Link to post
Share on other sites
20 hours ago, Red ochre said:

This Moshyfawn idiot is redistributing without permission.☹️

 

He (I assume the user is male)

Your assumption is correct!
I was able to locate a
Moshyfawn YouTube channel for him doing a PIP narration of an in-play video game capture from somewhere in Russia.

Edited by HyReZ

Share this post


Link to post
Share on other sites
11 hours ago, Red ochre said:

This Moshyfawn idiot is redistributing without permission.

 

I contacted GitHub technical support and received the following message:

 

Quote

Hello,

Thanks for contacting us. A great first step is to try contacting the user directly; in many cases, this type of thing turns out to be a misunderstanding that can be resolved by reaching out to them. You can check their profile page for contact information, or open an issue in the repository itself. If that's not possible, you may want to learn more about our DMCA takedown process.

If you are the copyright holder and want to have the content removed, you have the option of filing a DMCA takedown notice. Instructions, examples, and policy details are available here:

https://help.github.com/articles/dmca-takedown-policy/

https://help.github.com/articles/guide-to-submitting-a-dmca-takedown-notice/

If you're not the copyright holder, your best bet would be to contact the owner of the content and let them decide if they'd like to take action.

Thanks,
Devan

 

I would encourage everyone harmed by this idiot to file a DMCA takedown notice.

Share this post


Link to post
Share on other sites
2 hours ago, BoltBait said:

I would encourage everyone harmed by this idiot to file a DMCA takedown notice.

 

That is always an option, but hopefully the issue @Ego Eram Reputo opened will get them to remove the repository voluntarily.

Quoting the reply you received from GitHub support:

Quote

A great first step is to try contacting the user directly; in many cases, this type of thing turns out to be a misunderstanding that can be resolved by reaching out to them. You can check their profile page for contact information, or open an issue in the repository itself.

 

Moshyfawn's GitHub profile has a link to a Twitter account, so it may be possible to DM them.

The Twitter account includes a YouTube channel link at the top of the page, which I assume is the same one @HyReZ discovered.

 

Also, should this discussion be split into its own thread?

  • Like 1

Share this post


Link to post
Share on other sites

I found a copy of Color Matrix effect v.1.1 (update 25.6.2015).

I'll wait for a moderator to confirm that it's OK to upload the zip here so it can be posted on the first post. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.