Jump to content
How to Install Plugins ×

Lomography


BoltBait

Recommended Posts

For info see this post:

Photo Manipulation: Lomography

For Paint.NET 3.x, Download this plugin here:

Lomography.zip

If you are using Paint.NET 4.0+, download here:

Lameography.zip

How to install plugins: https://boltbait.com/pdn/InstallingEffects.php

If that doesn't work, post your troubles here: http://forums.getpaint.net/index.php?/forum/36-how-to-install-pluginsgeneral-plugin-troubleshooting/

Lomography.png

Updated CodeLab source code here:

 

// Title: BoltBait's Lameography v4.0
// Author: BoltBait
// Submenu: Photo
// Name: Lameography
// URL: http://www.BoltBait.com/pdn
#region UICode
int Amount1=-10; // [-100,100] Exposure
double Amount2=1; //[0,1] Hipster
#endregion

// Setup for using a specific pixel op
private UnaryPixelOps.Desaturate desaturateOp = new UnaryPixelOps.Desaturate();

// Setup for using a specific blend op
private UserBlendOps.NormalBlendOp normalOp = new UserBlendOps.NormalBlendOp();
private UserBlendOps.MultiplyBlendOp multiplyOp = new UserBlendOps.MultiplyBlendOp();

unsafe void Render(Surface dst, Surface src, Rectangle rect)
{
    Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
    int CenterX = ((selection.Right - selection.Left) / 2) + selection.Left;
    int CenterY = ((selection.Bottom - selection.Top) / 2) + selection.Top;
    int MaxWidth = (int)(((src.Width > src.Height)?src.Width:src.Height) * 1.2)/2;
    int MinWidth = (int)(((src.Width > src.Height)?src.Width:src.Height) * 0.5)/2;
    int barbieq25 = MaxWidth - MinWidth;

    // Setup for calling the Brightness and Contrast Adjustment function
    BrightnessAndContrastAdjustment bacAdjustment = new BrightnessAndContrastAdjustment();
    PropertyCollection bacProps = bacAdjustment.CreatePropertyCollection();
    PropertyBasedEffectConfigToken bacParameters = new PropertyBasedEffectConfigToken(bacProps);
    bacParameters.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Brightness, Amount1);
    bacParameters.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Contrast, 45);
    bacAdjustment.SetRenderInfo(bacParameters, new RenderArgs(dst), new RenderArgs(src));
    // Call the Brightness and Contrast Adjustment function
    bacAdjustment.Render(new Rectangle[1] {rect},0,1);

    // Now in the main render loop, the dst canvas has an adjusted version of the src canvas
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        if (IsCancelRequested) return;
        ColorBgra* srcPtr = src.GetPointAddressUnchecked(rect.Left, y);
        ColorBgra* dstPtr = dst.GetPointAddressUnchecked(rect.Left, y);
        for (int x = rect.Left; x < rect.Right; x++)
        {
            ColorBgra CurrentPixel = *dstPtr;

            int a = (int)Math.Abs(CenterX - x);
            int b = (int)Math.Abs(CenterY - y);
            // Remember the Distance Formula from high school geometry class?  Well, here it is...
            double c = Math.Sqrt( a*a + b*b );
            if (c > MaxWidth)
            {
                CurrentPixel = ColorBgra.Black;
                CurrentPixel.A = (byte)(255*Amount2);
            }
            else
            {
                if (c >= MinWidth)
                {
                    CurrentPixel = ColorBgra.Black;
                    // Remember PI from Algebra and Cosine from Algebra II?
                    CurrentPixel.A = (byte)((double)255*((-Math.Cos((c-MinWidth)/barbieq25 * Math.PI)+1)/2)*Amount2);
                }
                else
                {
                    CurrentPixel.A = 255;
                }
            }
            CurrentPixel = normalOp.Apply(*dstPtr, CurrentPixel);
            *dstPtr = CurrentPixel;

            // Now, let's make the picture moody...
            CurrentPixel = desaturateOp.Apply(CurrentPixel);
            *dstPtr = multiplyOp.Apply(*dstPtr, CurrentPixel);

            // And, we're ready for the next pixel.
            srcPtr++;
            dstPtr++;
        }
    }
}

Enjoy. B)beer.gif

Link to comment
Share on other sites

Thanks for the automated process for my tutorial!

Heh. You offer me a :mtdew: when I already have a beer.gif ? :shock: :P

And BoltBait, my friend, that's called Alcoholic Dew!

http://i46.photobucket.com/albums/f134/Code_Ember/daredevil_v3.png

Code_Ember passed away on October 25, 2008. The Paint.NET forum staff and members wish his family and friends only the best in this difficult time.

Link to comment
Share on other sites

Um does the Source Code work for others? I get some errors. (In Codelab)

I think BB was using a "newer" version of Codelab which he hasn't released yet :roll:

Yeah, sorry. I'm still working on CodeLab 1.3 and hopefully it will be released very soon.

Glad you all liked the plugin, though. All credit goes to the author of the original tutorial. 8)

Link to comment
Share on other sites

  • 2 weeks later...
Not that it matters to me but,

Lomography is the commercial trademark of Lomographische AG

from: http://en.wikipedia.org/wiki/Lomography

I'll use it, thanks.

Perhaps I should change the name to "Lameography". What do you think...

Link to comment
Share on other sites

Great Plugin Boltbait, but the result is a little heavy dont you think, could you possibly adjust it (mabye i'm asking too much) so that the whole picture becomes really dark and hard to see. I'm forced to use the tutorial instead.

EDIT:

Great plugin.

Notice Simon Brown put in the ™ in his reply title. :wink:

How did you even notice that? :shock: :shock:

Link to comment
Share on other sites

  • 7 months later...
  • 4 months later...
  • 1 month later...
  • 1 year later...

Would it possible to add an adjustment on the Vignette, Brightness and Saturation. As with some/most images, the effect is way too dark in the center. And, the Lomo cameras have a higher than normal saturation, not darker. That's why I think a Brightness adjustment is needed.

It can be adjusted with "Curves+", and the saturation can be adjusted with the Hue/Saturation+" dialog. But, it would be nice to have it one dialog, since PDN doesn't have a way to memorize multiple adjustments as a "preset"

Regards

Peter

Enjoy your photoghaphy, even if your spouse doesn't

Peter

Link to comment
Share on other sites

  • 2 weeks later...

Would it possible to add an adjustment on the Vignette, Brightness and Saturation. As with some/most images, the effect is way too dark in the center. And, the Lomo cameras have a higher than normal saturation, not darker. That's why I think a Brightness adjustment is needed.

It can be adjusted with "Curves+", and the saturation can be adjusted with the Hue/Saturation+" dialog. But, it would be nice to have it one dialog, since PDN doesn't have a way to memorize multiple adjustments as a "preset"

Regards

Peter

I second this one.

Great plugin, though.

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

×
×
  • Create New...