• Content count

  • Joined

  • Last visited

  • Days Won


LWChris last won the day on December 24 2016

LWChris had the most liked content!

Community Reputation


About LWChris

  • Birthday 10/14/1991

Profile Information

  • Gender
  • Location

Contact Methods

  • Website URL
  1. Hi @Pixey, here is an example of a more complex task you can perform with the plugin. Hopefully it helps you to understand what the plugin does, how it works and how to use it. At first, let me start with a short elaboration on what a "channel" is, in case this is still unclear: you can imagine a channel as a large value table. For each pixel in height, there is a table row, for each pixel in width, there is a column. Each table cell stores one value from 0 to 255 for the corresponding pixel. There are 4 actual and 3 calculated channels for an image (or to be more PDN specific, 7 channels per layer): Red, Green, Blue and Alpha are the actual channels (shortened RGBA). Hue, saturation and luminosity (HSL) are calculated from the RGB values. (As a side note, the transformation from RGB to HSL and vice versa is not completely bijective, as different HSL values can lead to the same RGB color.) My plugin is designed to tinker with the values of the RGBA channels. Maybe it'll learn about the HSL channels later on, too, but right now it's limited to the RGBA channels. Now for the tutorial part. In this tutorial, we are going to perform a "downward compression" for one color channel of an image, namely red. This can be done by choosing two values: first, a certain threshold value, second a compression ratio. Below our threshold, channel values will not be changed. Values above the threshold however will have their exceedance reduced by our compression ratio. This means for an increasing source value, above the threshold the result value growth will be slower and the overall maximum value will be lower. Usually this is a technique to compress audio signals to dampen peaks (see "dynamic range compression"), but we can do that for images' color channels, too. The following image illustrates the compression we are going to perform on the red channel, choosing a threshold value of 100 and a compression ratio of 3:1: For the above image, I created a 256 pixels wide gradient from blue (RGB = 0, 0, 255) to magenta (255, 0, 255), so that at the "0" mark, the pixel values are (0, 0, 255), at the "100" mark they are (100, 0, 255), and so on. What we expect to happen when we apply the compression is that the blue value stays 255 for the whole gradient like it is. The red value does not change up to the "100" mark, then the value change "slows down" to +1 red per 3 pixels, resulting in (152, 0, 255) for the pixel at the "255" mark. The "152" is the result of the maximum red value "255" processed with our compression formula: 100+(255-100)/3 = 100+155/3 = 100+51,666... = 152 after rounding. Now let's actually do this with my plugin. We are going to do it in three logical steps: Split the original Red value into the unmodified amount (left, 0-100) and the to-be-compressed amount (right, 0-155), in two separate channels Perform the actual compression on the channel with the to-be-compressed values Add up both values again and assign the result as new Red value Step 1 - Split the amounts into two channels Given that my plugin has no single operation to perform the split operation, this step is probably the trickiest to figure out if you're not used to "chaining multiple simple operations to perform a complex operation". For me, being a programmer, seeing the tiny steps in complex tasks is what I do for a living, so it's obvious for me how to do it. Of course one does not have to be a programmer to see it, but I guess it helps. Anyway, this is how we can do it in three smaller steps using operations my plugin actually offers: Step 1.1 At first, we are going to subtract our constant threshold value "100" from the Red channel values. This means, for values less than or equal to the threshold, the result will be less than or equal to 0. For values above the threshold, the result is going to be greater than 0. We can store the result in one of the two temporary channels. Step 1.2 Next up, we apply an L-Threshold operation to that temporary channel and configure it to set all values less than 0 (first parameter, top row) to 0 (second parameter, second row). After this step, our temporary channel contains the "to-be-compressed" value per pixel. Note that L-Threshold allows us to define the replacement value independently from the threshold value. Since the threshold and the replacement value are identical, we could also use the Clamp operation with "0" and "any number greater than or equal to 155" as arguments, so that the second argument does not apply to any value in the temp channel. In our scenario, it does not make a difference. Step 1.3 Eventually, we apply the U-Threshold operation to the Red channel, with a threshold and replacement value of 100. This limits all values to a maximum of 100, but keeps lower values unmodified. Now, the Red channel contains the unmodified value amount for every pixel. Step 2 - Compress Applying the compression ratio is actually pretty straightforward. You Divide the value in the temporary channel by our constant compression ratio "3" and write the result back to the temporary channel as target channel. Note that both temporary channels actually store floating point values, so for a pixel that originally had "105" as red value, the temporary channel now holds 5 / 3 = "1.666..." as value, not "2" yet. In our example, we are going to add the value to an integer number and then immediately round the result, so we're not going to profit from keeping the precision here. But sometimes you want to multiply or clamp the result later on and it's good to know that for those two channels the values are kept with double precision, which should be "good enough" in all normal cases. Step 3 - Add up Adding both values is also simple. As the previous sentence suggests, you chose the Add operation, select the red and the temporary channel as arguments, and apply the result as the new Red value. Again, there is something to "note". As with the temporary channel, the value of the Red channel was changed in step 1.3, and using it as source again get the modified value. This is why you can order the modification steps - because the order actually makes a difference. This is how the plugin configuration should look like now: Tip: In case you don't see a difference yet, make sure you enabled the modifications. Newly added modifications are disabled by default, as they are likely not configured correctly yet and IMO it makes no sense to render the whole image with a presumably wrong configuration over and over again. Also, modifications to disabled channels do not trigger a render update, keeping Paint.NET responsive while configuring the values. And this is how the result looks when the modification is applied with a selection of the gradient area. You can see how the color on the right end is far from magenta. With the color picker tool I have tested and can assure you, the Red values from 0 to 100 are 0, 1, 2, ..., 98, 99, 100, and the values from 101 to 255 are 100, 101, 101, 101, 102, ..., 150, 151, 151, 151, 152, which are the correct rounded values for 100.3, 100.6, 100.9, 101.3, 101.6, ... etc. I hope this extensive tutorial/example helps you to warm up to the plugin. Let me know if it helped you, I have an idea for another one, but I'd rather know if I need to change the way I write these tutorials first before I post another one in a second post taking me hours to write. Thank you for using my plugin, I hope it'll bring great joy and new possibilities to your art. Chris
  2. Hi Anthony, I actually saw your plugin, but it did not appear to fit my needs. If it had, I hadn't written the plugin. The main reason I made the plugin is because I work with OpenCV in Visual Studio from time to time. There is a plugin to display an image matrix as actual image again. OpenCV does not use RGB though, but BGR; yet the plugin interprets the channels as RGB, causing the Red and Blue channels to appear swapped. I could make a screenshot of that image and paste it to Paint.NET, but from what I can tell there is no possible operation chain to swap the channels back. Thus I decided to make a plugin for that (originally written in CodeLab and called "Swap Channels"). But then I thought "why not offer more operations", then noticed the CodeLab UI is too limited for this, and things got rolling. In the end, I ended up with a huuuge Visual Studio project and found the plugin to have been too much work to keep it for occasional personal use and not publish it. If I have understood your plugin correctly, it manipulates one channel, then the user clicks "OK", maybe opens the plugin again, manipulates the next channel, etc. In that case, an "Absolute" operation makes no sense since there are no negative input values in your use case. My plugin however allows you to chain multiple modifications (a necessity to perform a channel swap unless you have a dedicated "Swap" operation). Because of that, my plugin deliberately allows negative intermediate values in any channel. For example, you may assign "Red - 200" to the "Red" channel, and then continue to add values to that channel etc. In this case, "Absolute" can make sense, and since it's very cumbersome to simulate that operation with other operations but easy to implement it, I included it. I consider adding more features soon, but at that point, the functionality was rich enough to have it released. I'm not exactly sure what "Sharpen" is (haven't looked into your source code), but since it is not a specific channel operation, I will most likely not include some "overall visual effects" like sharpen, flatten, increase contrast etc. I spent five evenings on the plugin. One and a half on the calculation logic, three and a half on the layout planning and UI logic.
  3. I am not completely sure, but I think I just ran into the same bug and already found the cause. In the method populating the dropdowns, my maximum index was off by 1, making "Minimum" available as source operation for binary operations such as "Minimum", "Maximum", "Add", "Subtract" etc. Actually only Constant, Identity, Invert or Absolute should be allowed. Fixed in version 1.0.1, available as of now.
  4. Hi there! Well, you said you never heard about the framework and you didn't understand the name. That was my point, because now that you have the knowledge about the .NET framework, you do after all understand the reasoning behind the name, don't you? That's what I meant with "I think this is all one needs to know to see why the name is legit". It was not my intention to say everyone has to know that, because although the .NET framework is installed on every PC since Windows XP (so for 15 years now), it is more of a "silent" attendant. Actually I guess apart from programmers almost nobody knows about it, maybe "it is installed" if at all. I assume it might even be less commonly known than Direct X, because that piece of software is more troublesome so people have heard about it from error reports. So what I wanted to say in one sentence: I see why people might be confused about a software being call ".net", but my post should provide all the information you need to see 1) why the name was chosen, and 2) how the software, the company and the websites are related to each other. Happy new year!
  5. ".NET" (pronounce: dot-net) is the name of a software platform developed by Microsoft from 1990 until today. It is most famous for the .NET framework, an extensive code base in various programming languages. One of those languages is C# (pronounce: "c sharp"), the language Paint.NET is coded in. Since you cannot name the program "Paint" like in "MS Paint", the chosen name is "Paint.NET". Nothing "fake" about that. The URL "paint.net" (meanwhile a redirect, what a waste!) was already taken, so the alternate URL "getpaint.net" was registered as homepage. dotpdn.com is the homepage of the dotPDN LLC, the company "behind" the software. I think this is all one needs to know to see why the name is legit and good as it is.
  6. This plugin allows you to modify multiple channels of an image in various ways. Once installed, it can be found in the Adjustments menu, since it is more of an adjustment utility than an effect. Basics - How the Plugin Works In the plugin's dialog, you can configure multiple channel modifications. Each modification allows you to manipulate one channel of the image with one of the built in operations. Every operation uses one or more arguments to calculate the new value for the target channel. The number, form and usage of those arguments depends on the chosen operation. The modifications are executed per pixel and in the order you have arranged them. Use the ˄ and ˅ buttons to re-arrange the modifications, the + button to add more, the × button to remove one, and check/uncheck the Enabled flag to switch a modification on and off. Download and Installation Download from code.lwchris.de (my webspace) To install this plugin, please follow the usual steps when installing Paint.NET plugins: Download the zip file Extract the content Move the DLL file into the "Effects" folder in Paint.NET's root directory (for example "C:\Program Files\Paint.NET\Effects") Restart Paint.NET The plugin will appear as "Modify Channels..." in the Adjustments, not the Effects menu Changelog Channels Depending on whether you have to select the target channel to write to or the source channel to read from, different channels are available: Red/Green/Blue/Alpha - Gets or sets the value for the respective channel. These values always include the changes from previous modifications. Temp 1/Temp 2 - Gets or sets the value of the respective temporary channel Source Red/Green/Blue/Alpha - Gets the original, unmodified value for the respective channel (read-only) Average - Gets the average of the current Red, Green and Blue channel values (read-only) Grayscale - Sets the Red, Green and Blue channel to the given value (write-only) Channel value types The Red, Green, Blue and Alpha channels are int channels (and since Grayscale is just a shortcut for assigning all three at once, it has the same limitations). This means assigned values will be rounded to whole numbers, but are allowed to go way below 0 or above 255. After the last channel modification, their values are clamped to 0-255 and then interpreted as the resulting RGBA color. Temp 1 and Temp 2 are double channels, therefore they can store floating-point values. Reading from Average returns a double. Assigning that value to an integer channel will cause the assigned value to be rounded. Operations Operations can be split into four types: constant, unary, binary or ternary, depending on the number and type of arguments they take. 1. Constant operation The constant operation takes one constant value as argument. Constant (value) - Returns value 2. Unary operations Unary operations take one source channel as argument. Identity (channel) - Returns value of the channel Invert (channel) - Returns 255 - value of the channel Absolute (channel) - Returns -1 * value of the channel if value of the channel < 0, or value of the channel otherwise 3. Binary operations Binary operations take two constant or unary operations as argument. For Divide, the arguments may be augmented with an additional constant. Minimum (arg1, arg2) - Returns arg1 if arg1 < arg2, or arg2 otherwise Maximum (arg1, arg2) - Returns arg1 if arg1 > arg2, or arg2 otherwise Add (arg1, arg2) - Returns arg1 + arg2 Subtract (arg1, arg2) - Returns arg1 - arg2 Multiply (arg1, arg2) - Returns arg1 * arg2 Divide (arg1, arg2, [value]) - Returns arg1 / arg2; if arg2 is a channel, provide value as return value in case the channel value is almost 0 (i. e. < 0.00000001) 4. Ternary operations Ternary operations take one source channel and two constant values as arguments. Clamp (channel, min, max) - Returns min if value of the channel < min, max if value of the channel > max, or value of the channel otherwise L-Threshold (channel, min, value) - Returns value if value of the channel < min, or value of the channel otherwise U-Threshold (channel, max, value) - Returns value if value of the channel > max, or value of the channel otherwise Specification A specification of all possible channel modifications, given in EBNF. Examples Create an opacity map (the darker, the more opaque): Grayscale = Identity Alpha Alpha = Constant 255 Transform into pencil sketch: Alpha = Invert Average Grayscale = Identity Average Swap the red and blue channel: Red = Identity Blue Blue = Identity Source Red Note that Blue = Identity Red does not work, because the first channel modification has already changed the value of the Red channel Legal notes I hate this part, too, but it is somewhat obligatory for software... The plugin is free to use for anything permitted by applicable law (including commercial purposes). You are however not allowed to modify or sell this plugin. Do not redistribute the plugin except by sharing links to this forum post please. If you want to include it in your plugin pack, please ask for my permission first. The plugin is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall I or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the plugin or the use or other dealings in the plugin.
  7. When I make a linear gradient from the bottom left corner roughly in 45° angle, then I am able to bug the gradient into one that only runs though a small amount of the actual gradient range that should be applied. Steps to reproduce: 1) Open a new image 2) Select the gradient tool 3) Draw a gradient from the left bottom in about a 45° degree angle (to the top right) 4) When you slowly drag around the handle close to the image border, at some spot you can cause the visual gradient to bug into a horizontal direction and twice the length. Reproducible: always (10/10 tries; varying colours [red green, blue orange, unchanged black white], different canvas sizes [square, almost square, rectangle, unchanged 800x600]) Note that only the visual appearance and the outcome is affected, while the displayed toolbar values and handles stay at their correct positions. The appended screenshot should clarify what I am seeing. Windows 10 Insider Preview Version 1511, paint.net 4.0.9 (I know the screenshot says 4.0.8 but I was already able to reproduce it in 4.0.9, too)
  8. Left click on the toolstrip splitbutton for the blending mode alters the 16 blending modes in forward order "Normal > Multiply > Additive > Color Burn > Color Dodge > Reflect > Glow > Overlay > Difference > Negation > Lighten > Darken > Screen > XOR > Overwrite" As a matter of fact, I normally only use "Normal" and "Overwrite", since I mainly draw simplistic icons. It kind of bothers me I always have to open the dropdown to switch from "Normal" to "Overwrite", because otherwise I had to click 15 times. Could you add that right clicking selects the previous mode (also wrapping)?
  9. By the way, is there any way to switch to a straight line again, like a reset for the knobs? Or could there be a type like Bezier and spline, in which you can pull the outer ends and the middle two knows are hidden?
  10. Oh, okay...
  11. You still cannot select the secondary color from the colour wheel Is that really so hard to fix?
  12. Rick, please consider a quick release of a version with the selection outline fixed. It's really confusing *bites into his keyboard*
  13. Copy that, but I think this is just the "Application busy" cursor of Windows with its shadow not rendered properly. I'm not sure if Rick can fix this. Bug report: The bug that right-clicking the colour wheel does not select the secondary colour still persists.
  14. I've corrected a typo in the German translation for the ZoomTool.HelpText resource.
  15. 1) I left my laptop unattended for a while and it went to hibernate (not standby). After I had rebooted the system, the whole canvas area (the picture as well as the gray surrounding area) remained white until I resized the paint.net window to force a full repaint of the UI. Not sure this is reproducible since it needs some time until my laptop goes into hibernate. I'd appreciate someone else trying this, too. 2) When you copy anything at the bottom or righthand border of an image and paste it, it will not be pasted where it was copied but with 1 pixel margin. Reproducible: always.