Added 'Misc./man2png'
This commit is contained in:
parent
bc74dbd292
commit
8b05a13517
26
Misc./man2png
Executable file
26
Misc./man2png
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
# NOTE: i gpt-ed this to show something to xolatile
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
echo "Usage: $0 <manpage>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
path=$(man -w "$1" 2>/dev/null)
|
||||
if [ -z "$path" ]; then
|
||||
echo "Manpage not found for $1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$path" =~ \.bz2$ ]]; then
|
||||
decompressed=$(mktemp)
|
||||
bzip2 -dc "$path" > "$decompressed"
|
||||
path="$decompressed"
|
||||
fi
|
||||
|
||||
groff -Tpdf -mandoc "$path" > "${1}.pdf"
|
||||
|
||||
magick "${1}.pdf" -density 300 -background white -alpha remove -quality 100 "${1}.png"
|
||||
convert -append "${1}-*.png" "${1}.png"
|
||||
|
||||
echo "Generated PNG: ${1}.png"
|
Loading…
x
Reference in New Issue
Block a user