But how to convert it to jpg/png ?tmux capturep -p -e -S 0 -E 24|aha -b -l >file.html nearly works
aha is port/package
View attachment 15710
Thank You, I read about this and thinking... what's wrong if I directly say using "sc" in rc.conf?not supported with vt console, only with older sc
tmux capturep -p -e -S 0 -E 80 | aha -b -l |sed -e 's/<pre>/<pre style="font-family:unifont">/g' >s.html
This is exactly btop, bpytop or bashtop?View attachment 15715Code:tmux capturep -p -e -S 0 -E 80 | aha -b -l |sed -e 's/<pre>/<pre style="font-family:unifont">/g' >s.html
So, as I able to see, You much better in this than I amyou need a font that displays non ascii characters same width as the ascii one
normaly if the font in use do not have all the unicode glyphs they are are brought in from other fonts
i used gnu unifont to fix it
Code:tmux capturep -p -e -S 0 -E 80 | aha -b -l |sed -e 's/<pre>/<pre style="font-family:unifont">/g' >s.html
FreeBSD cannot starting after this, how to fix? (I have no zfs snapshot for yesterdaykern.vty=sc in /boot/loader.conf and reboot to enable sc
also iirc sc can't display unicode
1. Pressed "3" to escape to loader prompt;escape the boot menu
and at the prompt type kern.vty=vt
Thank You, all ok.set kern.vty=vt
I have a thought all this conversion would be a pressure on resources, this is hi-load server and I need something extremely "light"...if you still need images you probably can use some html2pdf kind of software but they need to use the same font
but html should be good enough for viewing
I have a thought all this conversion would be a pressure on resources, this is hi-load server and I need something extremely "light"...
Am I wrong about pressure on resources ?
Please, take my sorry about some kinde of stupidness (may be I need more clearly taking a question, a little bit tied in a country with a War...Can you explain why you want pictures instead of just text or html? They will make the process much heavier. And you can't copy and paste from them, they are not very practical for communicating about them.
Please, take my sorry about some kinde of stupidness (may be I need more clearly taking a question, a little bit tied in a country with a War...
As You may see by screenshots above in this thread, the are:
- rack server for hi-loading, w/ or w/o attached locally 17" monitor;
- after booting complete, the btop/bpytop automatically started on ttyv0 for server current state visual control by local tech stuff;
Also, there would be (and this is what I exactly asking for) some sh/zsh shell script to 24/7 periodically making screenshots (I think that would be "get dump of ttyv0 output, format it to bitmap and save as a .jpg/.png file) of btop/bpytop output (ASCII colors control, TUI interface), place this .jpg/.png to certain directory, and sending by schedule mail with this .jpg/.png attached and saving to remote cloud like Amazon S3/private collocation server/VPS).
Tech stuff using this "set of btop/bpytop states" as one of source of collected data for QC/QA (together with Prometheus, Grafana....).
Is this description exactly that You asking for?
Have a nice day!
Thank You for patience..I (we?) understand all that. Just not why you want to email bitmaps around instead of text.
Thank You for make me smileyI see that you have a hammer (= taking a screenshot) but I would recommend to rethink if this is really the right tool for the screw (server stats) you want to drill in.
People are trying to understand what you are trying to achieve to best help you.I just a little bit shocked, that in 2023 year we all in this thread need spend time on 2-nd page, trying to finding utility for I am just asking - "making scrnshot of a screen" (technically this mean "grab the ttyv0 buffer (TUI interface of app, encode to img form, write to file on local disk or remote storage")...
package require tdom
#lappend auto_path /extra/fs/d/tcl86/Tcl-amd64/lib
package require pdf4tcl
proc mm2p { x } {
return [expr {$x / 25.4 * 72}]
}
encoding system utf-8
set FONT_SIZE 18
pdf4tcl::new mypdf -margin 0 -paper A3 -landscape 1
pdf4tcl::loadBaseTrueTypeFont Baseunifont unifont-15.0.01.ttf
pdf4tcl::createFont Baseunifont TestFont utf-8
mypdf setFont $FONT_SIZE TestFont
mypdf setFillColor 0 0 0
mypdf rectangle 0 0 [mm2p 420] [mm2p 297] -filled 1
set fh [mypdf getFontMetric height]
set fw [mypdf getCharWidth T]
set html [read stdin]
set doc [dom parse -keepEmpties -html $html ]
set rootnode [$doc documentElement]
set x0 [mm2p 5]
set y0 [mm2p 5]
set x $x0
set y $y0
set ppnodes [$rootnode selectNodes "//span/text()"]
foreach node $ppnodes {
set pnode [$node parent]
set bold_hack 0
if { [$pnode hasAttribute style ] } {
set stl [$pnode getAttribute style]
set lsl [split $stl ";"]
foreach s $lsl {
if { $s == "" } { continue }
set ss [split $s ":"]
if { [llength $ss] == 2 } {
switch [lindex $ss 0 ] {
color {
lappend gugu [list setFillColor [lindex $ss 1]]
}
background-color {
lappend gugu [list setBgColor [lindex $ss 1]]
}
font-weight {
if { [lindex $ss 1] == "bold" } {
set bold_hack 1
}
}
}
}
}
}
set text [$node nodeValue]
set ltext [split $text "\n"]
set had_nl 0
set zz [string length $text]
for { set i 0 } { $i < $zz } { incr i } {
set shit [string range $text $i $i]
if { ![info exists A($shit) ]} {
set A($shit) 1
lappend Z [scan $shit %c]
}
}
foreach str $ltext {
if { $had_nl } {
set x $x0
set y [expr {$y + $fh }]
# puts ""
}
lappend gugu [list $str $x $y]
if { $bold_hack } {
lappend gugu [list $str [expr $x+0.3] [expr $y+0.3]]
}
set x [expr {$x +[string length $str] * $fw }]
# puts -nonewline $str
set had_nl 1
}
}
#puts $Z
pdf4tcl::createFontSpecEnc Baseunifont CombinedFont $Z
mypdf setFont $FONT_SIZE CombinedFont
foreach cmd $gugu {
set n [llength $cmd ]
if { $n == 3 } {
mypdf text [lindex $cmd 0] -x [lindex $cmd 1] -y [lindex $cmd 2]
} else {
mypdf [lindex $cmd 0] [lindex $cmd 1]
}
}
mypdf write
mypdf destroy
Because of this initially friendly mood of this FreeBSD forum, and of coarse, HUGE user experience, I love and thrust this community.People are trying to understand what you are trying to achieve to best help you.
I not imagin that one screen of app would be "a lot of textual data".Your requirements seem unusual to most people here - you want to capture a lot of textual data and then make a bitmap graphic of that text.
Or may be I need to be shortly.So everyone trying to understand WHY you want to do things this way - don’t think anyone does understand but at least we know now what you want to do.
I think it was confusing because you asked how to make a bitmap graphic for server health and metrics text. Maybe in this case there was a bit too much information initially.
Thank You for suggestion, but as I say before ANY extra loading on the server are strongly unwanted...If you really want the bitmap graphics I would run an xterm inside XPra and then capture with xwd or ImageMagick. Or even a real X11 server.