Advertisement
JimMcKeeth

getfaces.ps1

Jul 2nd, 2025 (edited)
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.23 KB | Source Code | 0 0
  1. set-location -path "~\pictures\people"
  2.  
  3. # Define the folder path
  4. $folderPath = "~\pictures\people"
  5. $extension = ".jpeg"
  6.  
  7. # https://github.com/LeandroBarone/python-ascii_magic
  8. # https://pypi.org/project/ascii-magic/
  9. pip install ascii_magic
  10.  
  11. #skip the rename
  12. if ($false) {
  13.     Write-Host "Renaming existing photos with random names"
  14.     # Get all .jpeg files in the folder
  15.     Get-ChildItem -Path $folderPath -Filter *.jpeg | ForEach-Object {
  16.         $randomName = [System.IO.Path]::ChangeExtension([System.IO.Path]::GetRandomFileName(), $extension)
  17.    
  18.         # Rename the file
  19.         Rename-Item -Path $_.FullName -NewName $randomName
  20.     }
  21. }
  22.  
  23. while ($true) {
  24.     $randomName = [System.IO.Path]::ChangeExtension([System.IO.Path]::GetRandomFileName(), $extension)
  25.     Write-Host "Downloading new person to filename: $randomName"
  26.     Invoke-WebRequest -Uri https://thispersondoesnotexist.com/ -OutFile $randomName
  27.     $file = Get-Item $randomName
  28.     $size = $file.Length
  29.     Write-Host "$size bytes downloaded"
  30.  
  31.     # Preview in ASCII Art
  32.     python -c "from ascii_magic import AsciiArt;import sys;art = AsciiArt.from_image('$randomName');art.to_terminal(columns=130)"
  33.     # Sleep for 1 second
  34.     Start-Sleep -Seconds 1
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement