-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmake-test-image.ps1
More file actions
35 lines (31 loc) · 1.01 KB
/
Copy pathmake-test-image.ps1
File metadata and controls
35 lines (31 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env pwsh
param(
[string]$Output = (Join-Path $PSScriptRoot "sample.png")
)
$ErrorActionPreference = "Stop"
Add-Type -AssemblyName System.Drawing
$bitmap = [System.Drawing.Bitmap]::new(900, 180)
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
try {
$graphics.Clear([System.Drawing.Color]::White)
$graphics.TextRenderingHint = [System.Drawing.Text.TextRenderingHint]::AntiAliasGridFit
$font = [System.Drawing.Font]::new(
"Segoe UI",
52,
[System.Drawing.FontStyle]::Bold,
[System.Drawing.GraphicsUnit]::Pixel)
$brush = [System.Drawing.SolidBrush]::new([System.Drawing.Color]::Black)
try {
$graphics.DrawString("DYNWINRT OCR 42", $font, $brush, 30, 45)
} finally {
$brush.Dispose()
$font.Dispose()
}
$bitmap.Save(
[System.IO.Path]::GetFullPath($Output),
[System.Drawing.Imaging.ImageFormat]::Png)
} finally {
$graphics.Dispose()
$bitmap.Dispose()
}
Write-Host "Created OCR test image at $Output"