Advice on graphic effect : plugins welcome

Imagine you have a screen full of ‘space invaders’
They appear in rows and are perfect replicas of each other.
Now imagine a box of eggs.
In general, they are very very similar, but they have tiny differences of position, shape, coloring.
They aren’t in exact regimen… some may be a little higher or lower up the screen.

Or think of a knitted garment… in theory each knit is the same, in practice each is slightly twisted or different.

What I would like to do is apply an effect or process to the ‘perfect’ image so that they are slightly imperfect.
A pixel higher or lower than the neighbour, maybe a tiny rotation.
Im wondering if there is a localised warp effect that anyone knows about that might be applied?
Half the battle for this kind of thing is knowing what such and effect might be called.

1 Like

What’s the goal? You’re getting close to steganography.

Exactly as described above. I want to take a perfectly arranged computer generated ‘grid’ of stuff , and shake it up a bit so it is less regimented.
I had to look up steganography.
I dont have a code to hide.
But as it happens, a picture I found on Wiki sums it up quite well… look at this image of a grid of letters. You can tell it is hand written because although it is in a grid and uses repeated symbols, they arent quite identical each time.

You want to randomize your graphics. Define an affine rotation and make it wiggle a bit. The same goes for color, size and whatever you can think of.

1 Like

means this image was not made by you and you will just modify?

The image is made by me with small repeatable elements.
I wish them to look less obviously repeated.

Is it enough to resize them (width / height and up / down) ?

1 Like

I’ll play with that idea first. AffineTransformation sounds a bit technical for me at this point… :wink:

Something like this?

Const Pi = 3.14159265358979323846264338327950

Dim w, h As Integer
w = img_egg.Width
h = img_egg.Height

Dim horizontalSpacing As Integer = -5
Dim verticalSpacing As Integer = -5

Dim colCount As Integer = g.Width/((w+horizontalSpacing)) - 2

Dim rowCount As Integer = g.Height/((h+verticalSpacing)) - 2

Dim x, y As Double

Dim angleMin As Double = -8*PI/180 //in radians
Dim angleMax As Double = 8*PI/180

Dim deltaXMin As Integer = -1
Dim deltaXMax As Integer = 1

dim rnd As new Random

for j as Integer = 0 to rowCount
  for i as Integer = 0 to colCount
    Dim centerX As Double = x + rnd.InRange(deltaXMin, deltaXMax)
    Dim centerY As Double = y + rnd.InRange(deltaXMin, deltaXMax)
    //Save state to restore it later
    //translate to center of drawing before rotation
    g.Translate(centerX, centerY)
    Dim rotation As Double = rnd.InRange(angleMin*100, angleMax*100)/100
    //Translate the other way round
    g.Translate(-centerX, -centerY)
    g.DrawPicture(img_egg, centerX, centerY, w, h, 0, 0, img_egg.Width, img_egg.Height)
    //Restore state
    x = x + w + horizontalSpacing
  next i
  x = 0
  y = y + h + verticalSpacing
next j


That looks very useful!
Thank you. :slight_smile:

1 Like

I like to use pixmapshape to show things like that

rem separate an egg from picture and put it in your code (egg-PIC)
Var px As New PixmapShape(eipic)
Dim w, h As Integer
g.DrawingColor = Color.White

Dim Rnd As New Random

For j As Integer = 40 To g.Width Step 80
For i As Integer = 40 To g.height Step 80
Dim myangle As Double = Rnd.InRange(-40,40)
px.Rotation= myangle * 0.017453292
g.DrawObject px,j,i
Next i

Next j

rem Resize your Window And the eggs will come To life

1 Like