# Brett Paufler # Copyright # 2019-08-16 # # PowerShell Script # Saved as a txt file # # Face Flip # Flips an image and combines the original with the flipped # Front-to-Front and Back-to-Back # # Given the right input, creates a face of sorts # # File Names Cannot Have Spaces $gm = 'c:\alpha\graphicsmagick\gm.exe convert ' $DIR_IN = 'C:\alpha\input' $DIR_OUT = 'C:\alpha\output' $images = Get-ChildItem -Name $DIR_IN ForEach ($image in $images) { #Temporary Image Paths $image_in = Join-Path -Path $DIR_IN $image $sn_temp_a = Join-Path -Path $DIR_OUT $image.Replace('.', '___a.') $sn_temp_b = Join-Path -Path $DIR_OUT $image.Replace('.', '___b.') $sn_face_a = $sn_temp_a.Replace('___a.', '_flip_a.') $sn_face_b = $sn_temp_b.Replace('___b.', '_flip_b.') #$image_in #$sn_temp_a #$sn_temp_b #$sn_face_a #$sn_face_b 'Working on... ' + $image_in #Temp A Image $command = $gm + $image_in + ' ' + $sn_temp_a Invoke-Expression $command #Temp B Image $command = $gm + '-flop ' + $image_in + ' ' + $sn_temp_b Invoke-Expression $command #Flip Front A $command = $gm + '+append ' + ' ' + $sn_temp_a + ' ' + $sn_temp_b + ' ' + $sn_face_a Invoke-Expression $command #Flip Back B $command = $gm + '+append ' + ' ' + $sn_temp_b + ' ' + $sn_temp_a + ' ' + $sn_face_b Invoke-Expression $command #Clean Up #Remove Temporary Images Remove-Item $sn_temp_a Remove-Item $sn_temp_b } 'FaceFlip Terminated w/o Errors'