Jump to content

Pixelize filter / plugin.


Recommended Posts

Hi is there a plugin which will do this specific pixelization effect?

i-love-you-pixelated-kids-shirts-kids-t-

 

Note the spacing in the pixels which has been achieved - pixelising in itself I imagine is probably easy but that whole 'snap to grid' conformity is good plus the pixels have a small 1 pixel spacing between them.

 

Thoughts? Thanks.

Link to comment
Share on other sites

That would be an extremely easy plugin to write (a few lines of code in CodeLab). Call the Pixelate effect and draw a grid. That's it. Further more, the templates in CodeLab would probably do 75% of the work for you.

@Eli, if you ever wanted to learn to write effects, this would be the time.

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

1 hour ago, Eli said:

It is a nice effect. I think someone will come with something.This is my try:

iloveyou-pixels-5114e17.png

 

Hey Eli,

 

That's actually a pretty good result, it just needs to have some kind of code which enforces each 'pixel' MUST be a single colour and that perhaps the 'gap' grid line over the pixels is a tiny bit larger (perhaps 2 pixels)

 

Did you just make that?

Link to comment
Share on other sites

Here's an Apple and the best I could produce from it.

http://imgur.com/a/dzBbH

 

It's not got 100% square pixels and the spacing between them isn't a uniform colour

Make no mistake, your plugin is fantastic :) but not quite doing what I'm after -  I'll try it regardless mind you, but I was hoping to produce very very low total colour content images.

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

I've found messing with the size of the cuboid and the quantity comes close to what I want but it's a bit fiddly - a 'lock' button to force it to always produce single colour pixels and consistent spacing would be nice, regardless of cuboid count.  Regardless it's very good, thank you.

Link to comment
Share on other sites

11 hours ago, toe_head2001 said:

That would be an extremely easy plugin to write (a few lines of code in CodeLab). Call the Pixelate effect and draw a grid. That's it. Further more, the templates in CodeLab would probably do 75% of the work for you.

@Eli, if you ever wanted to learn to write effects, this would be the time.

 

Toe_head2001, I was traumatized by code so many years ago. Somehow I found myself on a computers class (Fortran). The first day, the teacher assigned some exercises to do on a computer lab. And so I went, never before I had seen or touched a computer. The kids started to work on the assignment as soon as they sat down. I found an empty place and I sat down in front of a big screen. I started pressing the keyboard and nothing happened. My computer was OFF. I glanced to my left and to my right and I saw everyone typing things. I kept pressing the buttons on the keyboard and still nothing happened. I took out my notes and read that I had to switch the computer ON. I looked for the switch and could not seen any so figured it must be one of the buttons on the keyboard...  I kept pressing every key and nothing happened... Ten minutes later, a young lady noticed that I was typing and that my computer was OFF. She kindly showed me the switches for the screen and the central unit. They were in the back... I felt stupid. I turned the switches ON and a few minutes later some green words appeared on the black screen and I was prompted to enter a USERNAME and a PASSWORD . I looked at my notes and they said that in order to LOG ON I had to enter a USERNAME and a PASSWORD. So I typed "USERNAME" and "PASSWORD" and of course nothing happened. :) 

 

 

  • Upvote 1
Link to comment
Share on other sites

Eli, that's a sad story :| ... but also funny at the same time :lol:

 

@hamwizard, here's a script. Copy and paste it into CodeLab. If it's to your liking, I can publish it here on the forum as a plugin. If not, let me know what to change.

 

Spoiler

// Name: Cell Board
// Submenu: Stylize
// Author: toe_head2001
// Title:
// Version: 0.1
// Desc:
// Keywords:
// URL:
// Help:
#region UICode
IntSliderControl Amount1 = 20; // [0,100] Cell Size
IntSliderControl Amount2 = 1; // [0,100] Cell Spacing
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
    int cellSize = Amount1 + Amount2;
    PixelateEffect pixelateEffect = new PixelateEffect();
    PropertyCollection pixelateProps = pixelateEffect.CreatePropertyCollection();
    PropertyBasedEffectConfigToken pixelateParameters = new PropertyBasedEffectConfigToken(pixelateProps);
    pixelateParameters.SetPropertyValue(PixelateEffect.PropertyNames.CellSize, cellSize);
    pixelateEffect.SetRenderInfo(pixelateParameters, new RenderArgs(dst), new RenderArgs(src));
    pixelateEffect.Render(new Rectangle[1] { rect }, 0, 1);
    
    ColorBgra CurrentPixel;
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        if (IsCancelRequested) return;
        for (int x = rect.Left; x < rect.Right; x++)
        {
            CurrentPixel = dst[x, y];
            if (x % cellSize < Amount2 || y % cellSize < Amount2)
                CurrentPixel.A = 0;

            dst[x, y] = CurrentPixel;
        }
    }
}

 

 

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

I've come to the party late :(

 

Cellmaker!

 

Link to comment
Share on other sites

5 hours ago, toe_head2001 said:

Eli, that's a sad story :| ... but also funny at the same time :lol:

 

  Reveal hidden contents

 

 

 

I was frustrated at the time but now I thinks it is funny :)

 

The code is working :) I applied the effect to a layer that had a white background.

 

cellboard-effect1-5116b34.png

Link to comment
Share on other sites

You need to update your copy of CodeLab to the latest.  v2.17 was the Bee's Knees, and v2.18 had some nice speed improvements.

 

 

If you want to eliminate the translucent edges on the shapes, I can easily add a slider for opacity tolerance. For example, cells above 127 will become 255, and cell 127 & below will become 0.

  • Upvote 1

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

There you go... an option to make the cells opaque. Alpha values above the Tolerance level will become fully opaque, and values below the Tolerance level will become fully transparent.

Checkbox must be enabled/true.

 

Spoiler

// Name: Cell Board
// Submenu: Stylize
// Author: toe_head2001
// Title:
// Version: 0.2
// Desc:
// Keywords:
// URL:
// Help:
#region UICode
IntSliderControl Amount1 = 10; // [0,100] Cell Size
IntSliderControl Amount2 = 1; // [0,100] Cell Spacing
CheckboxControl Amount3 = false; // [0,1] Make cells opaque
IntSliderControl Amount4 = 127; // [1,255] Cell Opacity Tolerance
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
    int cellSize = Amount1 + Amount2;
    PixelateEffect pixelateEffect = new PixelateEffect();
    PropertyCollection pixelateProps = pixelateEffect.CreatePropertyCollection();
    PropertyBasedEffectConfigToken pixelateParameters = new PropertyBasedEffectConfigToken(pixelateProps);
    pixelateParameters.SetPropertyValue(PixelateEffect.PropertyNames.CellSize, cellSize);
    pixelateEffect.SetRenderInfo(pixelateParameters, new RenderArgs(dst), new RenderArgs(src));
    pixelateEffect.Render(new Rectangle[1] { rect }, 0, 1);

    ColorBgra CurrentPixel;
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        if (IsCancelRequested) return;
        for (int x = rect.Left; x < rect.Right; x++)
        {
            CurrentPixel = dst[x, y];

            if (Amount3)
            {
                if (CurrentPixel.A >= Amount4)
                    CurrentPixel.A = 255;
                else
                    CurrentPixel.A = 0;
            }

            if (x % cellSize < Amount2 || y % cellSize < Amount2)
                CurrentPixel.A = 0;

            dst[x, y] = CurrentPixel;
        }
    }
}

 

 

  • Upvote 1

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

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...