The Face Flip Algorithm using a concrete wall some miscellanous steel and a drainage pipe, it sort of looks like a robot with arms, but only sort of

Full PowerShell Script Utilizing GraphicsMagick
PowerShell FaceFlip

Hello PowerShell

This would be my first PowerShell Script. It's not that impressive. But a person has to start somewhere.

An image is flipped and then combined front ways and back with the original image, which in the ideal case, looks something like a face.

I had already implemented this in GraphicsMagic. So, the only trick was in converting it to a PowerShell script.

To allow execution of scripts on a one off basis (for this instance of PowerShell), I typed (and/or copy/pasted) the following at the prompt:

Set-ExecutionPolicy Bypass -Scope Process

Then, to confirm all was well:

PS C:\alpha> Get-ExecutionPolicy

I used the PowerShell ISE, which was better than going back and forth from the Shell and a Notebook (NPP).

But only a little better.

I had lots of syntax errors. But not a lot of clarity as to where those errors fell.

And this sort of blind programming necessitates very short programming iterations.

But then, not knowing what I am doing also forced the issue.

Finally, I don't give much credence to those who claim to be able to learn a new programming language over the course of a single weekend. But I must say, this went pretty fast, as all I was looking for was syntax... not style.

Yeah, sure. Argue I have no programming style. But what I mean is that I knew I needed a For Loop. So, all I really needed to do was figure out how to implement one in PowerShell. And it only took me a half hour or so to come across ForEach.

The same can be said of assembling strings, after figuring out a dollar sign ($) declares variables and Invoke-Expression was the way to execute a string, I had all the information I needed to implement my program... even if it's highly unlikely this is the best way to implement this particular program.

Which, of course, is why I would never claim to know PowerShell, at this point.

I've got a 'Hello World' (call it a FaceFlip) under my belt.

But not much else.

Now, if you'll excuse me. I think I can implement this same algorithm as a one liner in G'MIC.

GraphicsMagick FaceFlip
G'MIC FaceFlip
PowerShell FaceFlip

command line image manipulations

© copyright 2019 Brett Paufler