Plug-in SDK

Upcoming mother of all image editors
Post Reply
andydansby
Posts: 161
Joined: Fri Oct 29, 2010 6:00 am
Location: Syracuse, NY

Re: Plug-in SDK

Post by andydansby »

The SDK guide has been updated, with a minor correction on 16 bit images and formulas on Blending modes and Opacity blending of 2 images. Now at 132 pages of SDK goodness.

Andy Dansby

andydansby
Posts: 161
Joined: Fri Oct 29, 2010 6:00 am
Location: Syracuse, NY

Re: Plug-in SDK

Post by andydansby »

Here a new plugin - Blend ++.

This is the 32 bit version
blendplusplus.zip
(48.16 KiB) Downloaded 264 times
Here is the 64 bit version
blendplusplus.zip
(49.45 KiB) Downloaded 320 times
download and place in your plugin folder.

This plugin contains 27 different blending modes and a strength dial. The only reason I didn't place anymore is I ran out of space in naming and close to out of space on number of allowed UI statements.

Hope you enjoy

Andy Dansby

Rachel
Posts: 1920
Joined: Fri Nov 19, 2010 3:56 pm
Location: Oak Ridge, North Carolina

Re: Plug-in SDK

Post by Rachel »

I tried blending the original on top of a painterly layer with your new blend++. I think is is wonderful. Thanks for making it easy for me.
Attachments
PICT0194a_Final2web.jpg
PICT0194a_Final2web.jpg (98.43 KiB) Viewed 4013 times

bil abington, pa
Posts: 461
Joined: Sun Mar 03, 2013 11:26 am

Re: Plug-in SDK

Post by bil abington, pa »

andydansby wrote:Here a new plugin - Blend ++.
Hope you enjoy

Andy Dansby
Andy just curious why did you opt to go the strength route rather than the traditional opacity route. It really threw me off at 1st and will take some time to get used to. It's hard to teach an old dog new tricks when you've been doing it that way for years. It's one of those things you don't even think about it comes natural.
Have Fun Bill
Bill Somogyi

andydansby
Posts: 161
Joined: Fri Oct 29, 2010 6:00 am
Location: Syracuse, NY

Re: Plug-in SDK

Post by andydansby »

Rachel wrote:I tried blending the original on top of a painterly layer with your new blend++. I think is is wonderful. Thanks for making it easy for me.
Thank you Rachel, my aim originally was to add a couple of additional blending methods that I missed from GIMP, then I wanted to test some formulas from my SDK Guide, which turns out that some of them were plain wrong in my book (I have yet to fix the published formulas. Finally, I wanted to test some of the limitations of the SDK.

Next thing I knew, it seemed good enough to share with others.

This is probably not the final version of this plugin, as there are a number of things I want to ask Oscar about when I get a moment and then I just might release the code as open source for others to study.
bil abington, pa wrote:Andy just curious why did you opt to go the strength route rather than the traditional opacity route. It really threw me off at 1st and will take some time to get used to. It's hard to teach an old dog new tricks when you've been doing it that way for years. It's one of those things you don't even think about it comes natural.
Hi Bill, Strength should probably be renamed to Opacity or perhaps to Fade, however I chose "Strength" perhaps as a poor generalized naming after the fact.

As I commented above, this was originally a tester routine and came about with my personal desire to have a couple of GIMP blend modes.

The Strength portion of my plugin is based on the formula.

output = Bottomimage * MixingValue / 1.0 + Topimage * (1.0 - MixingValue) / 1.0;

with the MixingValue as an integer (percent) between 0 and 100, This formula and the others don't support the Alpha layer, which I think may perhaps change in another release/update.

As it stands now the Strength dial at 0 will display the Original (Main) Image and at 100 will show the fully blended image.

Sometime in the future, I will probably post the code for others to modify as they see fit or rip the code for their own personal desires. Again, with the caveat that the modified code be reposted for others to see so we can all learn.

Thanks
Andy Dansby

andydansby
Posts: 161
Joined: Fri Oct 29, 2010 6:00 am
Location: Syracuse, NY

Re: Plug-in SDK

Post by andydansby »

The SDK Guide has been updated again with some corrected blending formulas, still at 132 pages.
I am looking for some image processing formulas with sample codes in c++ and or formulas with simple explanations. If you submit, please try to place the formula or code in the 0-1 floating point range. I will try to test any code before including in the guide for accuracy. You can either private message me or simply post to the boards.

Thanks
Andy Dansby

JEL
Posts: 295
Joined: Fri Jan 06, 2012 9:35 pm
Contact:

Re: Plug-in SDK

Post by JEL »

Can the Reactor-Script block inside Photo-Reactor do exactly the same as externally compiled dll scripts?

I have no love for MSVC really, but I'd like to do some scripting in cpp if the script-block is just as capable (other than being slower)

The starting is the tough part though :)

What would the working code look like, for the Reactor-Script block, that can do a simple normalize of the histogram? That might be a good base to build more scripts from.
DAP (AOPs): http://jelstudio.dk/DAP/
PhotoReactor (flows, effects and scripts): http://jelstudio.dk/PhotoReactor/

andydansby
Posts: 161
Joined: Fri Oct 29, 2010 6:00 am
Location: Syracuse, NY

Re: Plug-in SDK

Post by andydansby »

JEL wrote:Can the Reactor-Script block inside Photo-Reactor do exactly the same as externally compiled dll scripts?

I have no love for MSVC really, but I'd like to do some scripting in cpp if the script-block is just as capable (other than being slower)

The starting is the tough part though :)

What would the working code look like, for the Reactor-Script block, that can do a simple normalize of the histogram? That might be a good base to build more scripts from.
I haven't worked with the script block at all so , however the algorithm for Histogram stretch is found in the white balance, it does not use an array of any sort, so should the transferable. You would find in the current image what the darkest pixel and the brightest pixel, you would then adjust the current image pixel by pixel using the algorithm pixel=((pixel-darkest pixel)/(brightest pixel - darkest pixel)) *255.0

hope that helps
Andy Dansby

JEL
Posts: 295
Joined: Fri Jan 06, 2012 9:35 pm
Contact:

Re: Plug-in SDK

Post by JEL »

Thank you very much! I'll see if I can convert that particular routine into a working script for the reactor-script block and then post it.
DAP (AOPs): http://jelstudio.dk/DAP/
PhotoReactor (flows, effects and scripts): http://jelstudio.dk/PhotoReactor/

JEL
Posts: 295
Joined: Fri Jan 06, 2012 9:35 pm
Contact:

Re: Plug-in SDK

Post by JEL »

...and here's the result :) Thanks Andy :)

This code can be directly copied into the Reactor-Script block as is.

It can also be saved in a text-file, which you then rename to "*.rcscript", and then loaded directly from within the Reactor-Script block via the load command.

It will normalize the histogram (stretch without changing color)

Code: Select all

// Please retain this intro-comment
// This software is FREE!!  Open Source software, do what you want with it, open to the community, etc.....
// GNU General Public License
// see http://www.gnu.org/licenses/gpl-2.0.html

// The only thing I ask is that if you find an error or nice addition, 
// that you post the modified source on the Mediachance message boards or contact me
// andydansby so I can modify the code.

// written by Andy Dansby, not Copyrighted, OPEN SOURCE

// modified and adapted for Photo-Reactor Script-block by JEL 2013


void HistogramStretch(image &img)
{
	int colorspace = 255;//used for interger, this is the color space 0-255

  	int width = img.width;
	int height = img.height;

	////////////////// MAX
	int maximumred = 0;
	int maximumgreen = 0;
	int maximumblue = 0;

	////////////////// MIN
	int minimumred = 65535;
	int minimumgreen = 65535;
	int minimumblue = 65535;

	///////////////// to prevent going above colorspace
	int rr;
	int gg;
	int bb;

	// int colorspace = 255;//used for interger, this is the color space 0-255


	for (int y=0; y<height; y++)
	{
		for (int x=0; x<width; x++)
		{

			// one way to get color from pixel
			pixel color = img.Pixel(x,y);

			int red = color.r;
			int green = color.g;
			int blue = color.b;

			//find max
			if (red > maximumred) {maximumred = red;}
			if (green > maximumgreen){maximumgreen = green;}
			if (blue > maximumblue){maximumblue = blue;}

			//find min
			if (red < minimumred){minimumred = red;}
			if (green < minimumgreen){minimumgreen = green;}
			if (blue < minimumblue){minimumblue = blue;}

		}
	
	}

	for (int y=0; y<height; y++)
	{
		for (int x=0; x<width; x++)
		{

			// one way to get color from pixel
			pixel color = img.Pixel(x,y);

			int red = color.r;
			int green = color.g;
			int blue = color.b;

			// lets stretch the histogram
			// clipping max value if over 255
			// This area would need to be modified if Photo-Reactor started supporting 16 bit per pixel color resolution
			// you could use the built in CLAMP255, but if you felt like rewiting the CLAMP function, here's how you would do it.
			rr = ((red - minimumred) * (colorspace)) / ((maximumred - minimumred) + 1);
			if (rr > colorspace) { rr = colorspace;}

			gg = ((green - minimumgreen) * (colorspace)) / ((maximumgreen - minimumgreen) + 1);
			if (gg > colorspace) { gg = colorspace;}

			bb = ((blue - minimumblue) * (colorspace)) / ((maximumblue - minimumblue) + 1);
			if (bb > colorspace) { bb = colorspace;}

			img.SetRGB(x, y, rr, gg, bb);

		}
	
	}

}



void main()
{
	// get the image from input socket
	image img(INPUT);
	
	
	// sample function call
	HistogramStretch(img);
	
	
	// send the image to output
	img.SetOutput();
	
}
DAP (AOPs): http://jelstudio.dk/DAP/
PhotoReactor (flows, effects and scripts): http://jelstudio.dk/PhotoReactor/

Post Reply