Tanel
-
Posts
205 -
Joined
-
Last visited
-
Days Won
3
Posts posted by Tanel
-
-
Hi,
I'm trying to implement GaussianBlurEffect for final touch-up of alpha values in my effect plugin (feathering, basically).
To accomplish this, I built extra surface where core of my effect is rendered,
then I call GaussianBlurEffect to render from tempSurface to dstArgs.
The problem is that blur effect comes out distorted.
Zoomed-up screenshots below.
Instead of turning this (original):
to this (desired effect):
I get this (distortion):
Amount of distortion varies by size of selection,
so I guess I have some bounds misalignment going on, but I couldn't diagnose the exact cause.
Can you point out what's wrong here? I'm completely stuck in this... :?
Simplified code sample from VS2005:
// MAIN RENDER public override unsafe void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length) { // BUILD A SURFACE "tempSurface" FOR BACKROUND RENDER Size surfaceSize = new Size(srcArgs.Surface.Width, srcArgs.Surface.Height); Surface tempSurface = new Surface(surfaceSize); RenderArgs temp = new RenderArgs(tempSurface); // CALL THE BACKROUND RENDER ON tempSurface RenderAlpha(parameters, tempSurface, srcArgs, rois, startIndex, length); EffectPluginConfigToken token = (EffectPluginConfigToken)parameters; PdnRegion selectionRegion = EnvironmentParameters.GetSelection(srcArgs.Bounds); Rectangle selection = EnvironmentParameters.GetSelection(srcArgs.Bounds).GetBoundsInt(); // RENDER BLUR FROM tempSurface TO dstArgs PropertyBasedEffectConfigToken blurToken = new PropertyBasedEffectConfigToken(this.blurProps); blurToken.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, token.Feather); this.blurEffect.SetRenderInfo(blurToken, dstArgs, temp); base.OnSetRenderInfo(blurToken, dstArgs, temp); this.blurEffect.Render(rois, startIndex, length); for (int i = startIndex; i < startIndex + length; ++i) { Rectangle roi = rois[i]; for (int y = roi.Top; y < roi.Bottom; ++y) { ColorBgra* dstPtr = dstArgs.Surface.GetPointAddress(roi.X, roi.Y); ColorBgra NewPixel; ColorBgra OrigPixel; byte a, ro, go, bo, ry, by, gy, ay; for (int x = roi.Left; x < roi.Right; ++x) { NewPixel = dstArgs.Surface[x, y]; //r = NewPixel.R; //g = NewPixel.G; //b = NewPixel.B; a = NewPixel.A; // THIS SHOULD BE BLURRED ALPHA if (selectionRegion.IsVisible(x, y)) { OrigPixel = srcArgs.Surface[x, y]; ro = OrigPixel.R; go = OrigPixel.G; bo = OrigPixel.B; //ao = OrigPixel.A; // FINAL PIXEL TO CONSIST OF ORIGINAL RGB + BLURRED ALPHA: ry = Utility.ClampToByte(ro); gy = Utility.ClampToByte(go); by = Utility.ClampToByte(bo); ay = Utility.ClampToByte(a); NewPixel = ColorBgra.FromBgra(by, gy, ry, ay); *dstPtr = NewPixel; //++srcPtr; //++tmpPtr; ++dstPtr; } } } } } // BACKROUND RENDER private unsafe void RenderAlpha(EffectConfigToken parameters, Surface surface, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length) { EffectPluginConfigToken token = (EffectPluginConfigToken)parameters; for (int i = startIndex; i < startIndex + length; ++i) { Rectangle roi = rois[i]; for (int y = roi.Top; y < roi.Bottom; ++y) { ColorBgra* ptr = surface.GetPointAddress(roi.X, roi.Y); ColorBgra OrigPixel; byte ro, go, bo, ao, ry, by, gy, ay; for (int x = roi.Left; x < roi.Right; ++x) { OrigPixel = srcArgs.Surface[x, y]; ro = OrigPixel.R; go = OrigPixel.G; bo = OrigPixel.B; ao = OrigPixel.A; //CODE SNIPPED AT THIS POINT, (200 LINES OF HARDCORE MATH, BORING REALLY //FOR MATTER OF SIMPLICITY IN THIS SAMPLE I JUST USE: ry = Utility.ClampToByte(ro); gy = Utility.ClampToByte(go); by = Utility.ClampToByte(bo); ay = Utility.ClampToByte(ro); // GET ALPHA FROM RED IN THIS SAMPLE OrigPixel = ColorBgra.FromBgra(by, gy, ry, ay); *ptr = OrigPixel; ++ptr; } } } }
-
I have updated the Plugin to version 2, please upgrade.
Improved UI and performance, see details highlighted in original post.
Source code released as well
-
...
I noticed, though, it doesn't keep shadows, just like the curves+ method I used above.
I his original post, agent007bond says:
Basically I should be able to remove the background colour (of my choice) and go back to the transparent version (top left) without losing shadow and translucency (partly transparent pixels at edges).Do you think it's possible to implement this (without too much work, I mean)?
It is possible to keep shadows, by playing around with saturation and brightness limiters.
But making the shadow semi-transparent is not yet possible (I'm adding Fade control for this).
In order to desaturate the shadow, you should use Conditional Hue/Saturation plugin.
-
Just out of interest what more are you thinking (hoping) of adding to the plug-in in the future. Personally i would recommend incorporating the "Feather" plug-in"feather" plug-in from BoltBait or the "Anti-alias" plug-in from jsonchiu in future editions.
Geoff
Thx for feedback, Geoff.
I will definitely add Amount control for backround transparency.
Second I add Fade control for smooth alpha fall-off through hue/saturation/brightness channels.
But Feather seems to be tricky to implement. Because I already pre-render blur effect for Tolerance control. Maybe I figure out something. Final version has still long way to go.
-
As a coincidence, I have been developing similar plugin for some weeks.
You can try this "draft" version: Link
(it is not yet fine enough to be published in plugins section)
My basic idea for this plugin is to extract certain color range from image, by making surrounding pixels transparent. Hence the name Tone Picker.
"Invert" mode should give you the "chroma key" effect.
The plugin uses primary color to define it's default color range.
So: I recommend to use color picker tool *before* opening the plugin - to define your color of interest.
By default this plugin will extract pixels with hue P+-30, saturation P+-20, brightness P+-50 (P for primary color).
You can override the input parameters by moving hue, saturation and brightness controls.
Tolerance control makes selection more "rough" by ignoring fine details.
Please comment.
-
BoltBait,
it seems that there is a bug:
if original pixel is semi-transparent (with alpha whatever between 0 - 255) then Alpha Blur reduces original alpha before blurring. For example: evenly semi-transparent area with alpha 127 becomes to alpha 62 (the lower the radius, the lower it goes).
Can you fix it so that original alpha would remain untouched?
P.S. Can you also increase max radius to 200?
Thanks,
Tanel
-
Is there a tool in paint.net I can use to remove these lines (somehow blurring them into the photo possibly??) Also, there are white specks of dust in the pic; is there a way I can remove them?
Forget the blur, it will destroy your image.
For best results take some time and use Clone Stamp to repair the defects manually.
-
I would like to be able to add a plain white border, 4px wide, to an image. Is there an easy way to do this??
Yes:
Image > Canvas Size
Set Anchor to middle and increase Pixel size both in width and height by 8px. (ignore other controls).
-
Got a bug: most of plugins don't load on my XP laptop anymore...
Problem solved! It was all my own bad... :oops:
Please excuse me for this BS.
I was studying evanolds' source code of conditional hue/saturation effect in C#, and apparently rebuild command dropped PaintDotNet.Core.dll and PaintDotNet.StylusReader.dll into the Effects folder. Just had to delete those and everything works normally again.
Thanks MadJik and Fisherman's Friend for pointing me towards solution.
-
Make a selection, invert it and turn the surroundings transparent (using transparency plugin).
Then run Alpha Blur.
See a similar sample and plugin links in this post.
-
Got a bug: most of plugins don't load on my XP laptop anymore...
Load errors list: link
I had no such problem with PdN beta1. I haven't changed any settings on my computer.
Any idea what's wrong?
No such problem on my desktop PC (also XP)...
-
i was wondering
if it's possible to
color pictures the
way shown in the below icons
in paint.net...??
like the warm-ish kinda coloring?
Try White Balance plugin to make photos warmer or cooler: viewtopic.php?f=16&t=20318
...though I think it's impossible to edit average snapshots to *match* professional photos.
-
:idea: hmm ok then so if im doing a mixed image of text,drawn art and panels (comic book) is it better to save it as .png for web viewing or .jpg
It will be a web based comic book so thats what im concerned about..i read how .jpg is better for photos and that I knew but I have never saved anything with a .png format before
I would recommend to publish this kind of stuff in .GIF format. You will get the smallest file sizes without remarkable loss.
PNGs are huge, you dont want viewers to wait for images downloading.
Make both gif and png copies of your art and compare for yourself.
Some information here: http://www.wfu.edu/~matthews/misc/jpg_v ... VsGif.html
-
Cool, thanks! Works much better for me (no more plugin errors)
But... Ed's Surface Blur is still not loading :?
-
I will look into errors after PDN 3.20 is over alpha stage.
Meanwhile use 3.10 for real work.
-
Plugin Error:
File: C:\Program Files\Paint.NET\Effects\ShadowHighlight.dllEffect Name: ShadowHighlight.EffectPlugin
Full error message: PaintDotNet.WorkerThreadException: Worker thread threw an exception ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: 0 is not a valid value for Radius
at PaintDotNet.PropertySystem.Property.set_Value(Object value)
at PaintDotNet.Effects.PropertyBasedEffectConfigToken.SetPropertyValue(Object propertyName, Object newValue)
at PaintDotNet.Effects.BlurEffect.OnSetRenderInfo(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs)
at PaintDotNet.Effects.BlurEffect.Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, Int32 startIndex, Int32 length)
at ShadowHighlight.EffectPlugin.Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, Int32 startIndex, Int32 length)
at PaintDotNet.Effects.BackgroundEffectRenderer.ThreadFunction()
--- End of inner exception stack trace ---
at PaintDotNet.Effects.BackgroundEffectRenderer.Join()
at PaintDotNet.Effects.BackgroundEffectRenderer.Start()
at PaintDotNet.Menus.EffectMenuBase.<>c__DisplayClassa.b__8(Object sender, EventArgs e)
Rick, do I need to revise my code?
Shadow/Highlight plugin uses minimum gaussian blur radius 0 - just because it is possible in PDN 3.10. Why not in 3.20?
-
Using Auto level made the blood a bit too dark. :idea: :?
I didn't want to take all fun away :wink:
I would fix the blood by copying the spots on a new layer (with magic wand);
then open adjustments->levels:
clear R channel check box and turn the middle output slider down to 3.0 (G and B channels only)
check R channel and clear B&G
Rise the middle output slider up to 0.5 (R channel only)
OK
then play with layer opacity for final touch.
-
My try, followed steps by Ash with slight changes:
[started from original image]
1. Surface blur (default)
2. Auto Level (to remove bluish cast and increase contrast)
3. Sharpen+ (amount 100, radius 4)
-
Rick,
while you're improving UI, any chance to enhance Clone Stamp to use right mouse button to pick (alternatively)?
Currently Ctrl+left mouse button picks while right button has no use.
I imagine Clone Stamp would be much more handy to use: right click to pick, left click to paste.
Thanks.
-
Slight problem with the control heights here:
tdue, I could not reproduce your problem under any circumstances. It must be a fault in your system.
Seeing the strange blue button sitting next to red close-button in your screenshot, I guess it's your graphics card's extended display functions not working well with your OS. Try disabling those functions if you don't desperately need them (nview, hydravision or whatever they call this piece of software).
Any chance of a source code for this amazing plug-in?Yes, in some time.
-
Anyone interested to contribute my plugins development?
Please help me to edit this code carcass into working PdN effect C# code, so that I could use blurred RGBA values in further effect calculations. My skills are too weak to re-code it.
I want to boost the performance of my Sharpen+ and ShadowHighlight plugins by replacing Gaussian blur with much faster one (I hope that fast blur's visual quality is good enough for that purpose). Unfortunately there is no built-in fast blur effect in PdN.
There is another implementation with a link to source code here.
Thanks...
-
Hey dudes!
I've got a new idea for the SaturationZeroProblem:
An Interface with 3 Sliders whcih set how important for the difference the channel should be. (i.e. with Value Importance = 100% and both other = 0% only the brightness of the pixel would be important)
But you can't set the Hue importance but only the maximal hue importance. And the less Saturation a pixel has the less Hue will be important. So there would be no sharp edges.
Anyone understood what I just said?
Please feedback (good idea/understood nothing/bad idea)
I would recommend to test it yourself. If YOU find it useful for some real operation then it should be okay.
-
Nice pic, BoltBait!
I'm definately loving the beginner mode. 8)it does most of the job for me too.
Hi everyone! I agree this is an awesome plugin, similar to the one I use in HP photo printing, just more detailed. The only problem I have run into is that it takes forever to render the changes I make with it. Are my computer settings off (more virtual ram needed, not pressing the review button correctly, etc.) or is this due to the way the plugin was coded (I think I read in another thread a plugin took too long to render due to the source code). Any advice would be helpful. Thanks!I am using a Dell 4400, pentium 4 processor, 1.7ghz, 256 ram, nvidia geforce 2 graphics card.
Yes, this plugin is heavy on resources, due to Gaussian blur being part of the algorithm (@ radius 12 in Basic mode).
In my PC it takes few sec to render 800x600 image, but about 30 sec for 6MP image (1.73GHz, 504MB RAM).
More RAM should speed up any photo editing remarkably. Graphics card doesn't matter as effect computing goes on in CPU+RAM only.
For faster workflow you could use a resized copy (or small selection) of your image to find suitable settings, run the effect once to load settings into memory, then open original image and run the effect with just OK-ing the presets.
I would really like to implement fast blur instead of Gaussian but haven't found good chance to do it. I wish there would be Fast Blur effect built in PDN, then we could call it from plugins with just 1 line of code.
-
You could try Conditional Hue/Saturation plugin.
See the replies by Ash in this topic to learn how it works.
Problem with Rendering Effect from Third Surface
in Plugin Developer's Central
Posted
Thank you guys!
Ed, I got your point, blur effect requires complete source image before start, but in my case it receives source image strip by strip, hence distorted results.
pyrochild, does your Film plugin contain complete workaround for this?
If so, then I'm a bit confused of Ed's comment:
I will study your Film plugin code thoroughly, very helpful indeed!
Did I guess the sequence of six main operations correctly?
Could you kindly explain logic of the tricks implemented there, six places I marked with "???":
Thanks!