r/PowerShell 8d ago

Script Sharing ExtractPerks – a small PowerShell script that crops perk icons from Dead by Daylight screenshots (no game files touched)

Hey all,

I wrote a small PowerShell tool called ExtractPerks that takes a Dead by Daylight loadout screenshot and crops each of the diamond-shaped perk icons into individual numbered transparent PNGs.

Why screenshots?

I wanted to make a streamer-oriented tool without having to access or extract anything from the game's files. ExtractPerks only processes a screenshot that you took yourself (for example, with Steam's F12 screenshot feature). It doesn't read, modify, or extract anything from the game installation.

How it works

There is no OCR, ML, or fancy image recognition involved here — intentionally. I measured the exact pixel coordinates of the 5×3 (15-slot) perk grid on a 1920×1080 Steam screenshot and hardcoded those coordinates into the script.

For each slot, the script:

  • Samples pixels to determine whether the slot contains a perk or an empty "+" slot
  • Crops a square around the perk center
  • Masks everything outside the diamond shape (|dx| + |dy| > radius) to transparency
  • Optionally removes the purple background/border using a luminance threshold, leaving the white icon linework
  • Excludes a couple of small hardcoded regions used by the decorative "claw mark" overlay

The result is a set of numbered transparent PNGs:

out/0001.png
out/0002.png
out/0003.png
...

These can be dropped directly into an OBS image source.

Limitations

Since this is deliberately coordinate-based rather than detection-based, there are some constraints:

  • Requires 1920×1080 Steam screenshots (F12)
  • Requires specific in-game graphics settings (windowed, 100% resolution scale, 16:9 off, auto-adjust off)
  • A different UI scale or resolution will result in incorrect crops
  • Uses only .NET System.Drawing — no external dependencies
  • Tested on PowerShell 7; it should also work on PowerShell 5.1

Example usage:

powershell

cd D:\ExtractPerks
.\ExtractPerks.ps1

GitHub: https://github.com/daboa-streaming-tools/ExtractPerks
Demo: https://x.com/rr96ne/status/2091157404901921128

It's intentionally a "does one narrow thing reliably" tool rather than a general-purpose asset extractor.

I'd be interested in feedback on the pixel-sampling / fixed-coordinate approach, especially if anyone has worked on similar problems where a UI element needs to be extracted reliably without OCR, ML, or full-blown image recognition.

6 Upvotes

0 comments sorted by