Jump to content

How to reverse colors in an EXE app using VB (or code compatible with EXE)


Winston
 Share

Recommended Posts

I'm trying to either invert the color picture without brightness affected, or rotate color hue by 180. With no success looking that up, I tried this;
        Dim grayscale As New Imaging.ColorMatrix(New Single()() _
    {
        New Single() {0, 0.5, 0.5, 0, 0},
        New Single() {0.5, 0, 0.5, 0, 0},
        New Single() {0.5, 0.5, 0, 0, 0},
        New Single() {0, 0, 0, 1, 0},
        New Single() {0, 0, 0, 0, 1}
    })
Colors were very lossy. I look for a way to restore or double Saturation after doing this. Nothing on the internet was working, and I need something like a toggle button that can reverse colors without or very small color loss and can be repeated.

Help? (And yes, combining what I am looking for and Invert would result in an image inverted without changing color.)

Link to comment
Share on other sites

While I wait for a reply, I tested this in GIMP by using "Colors/Components/Channel Mixer", but this again won't do, this time because it becomes too saturated. However, that was GIMP. This code is written for similar effect in Visual Studio code:
       Dim grayscale As New Imaging.ColorMatrix(New Single()() _
    {
        New Single() {-0.5, 1, 1, 0, 0},
        New Single() {1, -0.5, 1, 0, 0},
        New Single() {1, 1, -0.5, 0, 0},
        New Single() {0, 0, 0, 1, 0},
        New Single() {0, 0, 0, 0, 1}
    })
Please reply soon, I have waited several hours with no response.

Link to comment
Share on other sites

On 6/23/2021 at 1:48 AM, Winston said:

While I wait for a reply, I tested this in GIMP by using "Colors/Components/Channel Mixer", but this again won't do, this time because it becomes too saturated. However, that was GIMP. This code is written for similar effect in Visual Studio code:
       Dim grayscale As New Imaging.ColorMatrix(New Single()() _
    {
        New Single() {-0.5, 1, 1, 0, 0},
        New Single() {1, -0.5, 1, 0, 0},
        New Single() {1, 1, -0.5, 0, 0},
        New Single() {0, 0, 0, 1, 0},
        New Single() {0, 0, 0, 0, 1}
    })
Please reply soon, I have waited several hours with no response.

I might have meant for the 5th on to be {1, 1, 1, 0, 1}, but again, I could be mistaken.

Link to comment
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
 Share

×
×
  • Create New...