Discussion:
screenshot for vt(4)
(too old to reply)
Hiroo Ono
2023-07-03 15:44:37 UTC
Permalink
Hello,

I made a patch to enable screenshot with vt(4). The patch is here.
https://reviews.freebsd.org/D40858

I would like to hear comments and reviews if it can be merged to FreeBSD.
When I mentioned it on mastodon, the patch lacked one file, sorry.
Please try this if you want to get the patch in one file.
http://barleycorn.oikumene.net/ports-patch/0001-Implement-screenshot-with-vt-4.patch

There are three types of screenshot.
1. vidcontrol -p text < /dev/ttyv0 > screenshot.txt
which generate plain text output.
2. vidcontrol -p term < /dev/ttyv0 > screenshot.txt
which generate text with ansi escape sequences.
3. vidcontrol -p raw < /dev/ttyv0 > screenshot.raw
which generate a raw picture file.

The raw file can be converted to PNG via separate program.
http://barleycorn.oikumene.net/ports-patch/vtraw2png.tar.gz
https://helixteamhub.cloud/individual674914/projects/vtraw2png/repositories/vtraw2png/tree/default
It needs libpng (graphics/png).
It only supports 32bit depth, but I think it is enough for vt(4). Sorry if
I am wrong.

I only tested this patch on i386(vga) and amd64(efifb). The vga fb does not
support raw output (it does not have vt_fb_ioctl function).

Best regards.


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Hiroo Ono
2023-07-03 15:53:59 UTC
Permalink
Sorry, forgot to mention that there are examples here:
http://barleycorn.oikumene.net/ports-patch/
Post by Hiroo Ono
Hello,
I made a patch to enable screenshot with vt(4). The patch is here.
https://reviews.freebsd.org/D40858
I would like to hear comments and reviews if it can be merged to FreeBSD.
When I mentioned it on mastodon, the patch lacked one file, sorry.
Please try this if you want to get the patch in one file.
http://barleycorn.oikumene.net/ports-patch/0001-Implement-screenshot-with-vt-4.patch
There are three types of screenshot.
1. vidcontrol -p text < /dev/ttyv0 > screenshot.txt
which generate plain text output.
2. vidcontrol -p term < /dev/ttyv0 > screenshot.txt
which generate text with ansi escape sequences.
3. vidcontrol -p raw < /dev/ttyv0 > screenshot.raw
which generate a raw picture file.
The raw file can be converted to PNG via separate program.
http://barleycorn.oikumene.net/ports-patch/vtraw2png.tar.gz
https://helixteamhub.cloud/individual674914/projects/vtraw2png/repositories/vtraw2png/tree/default
It needs libpng (graphics/png).
It only supports 32bit depth, but I think it is enough for
vt(4). Sorry if I am wrong.
I only tested this patch on i386(vga) and amd64(efifb). The vga
fb does not support raw output (it does not have vt_fb_ioctl
function).
Best regards.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Hiroo Ono
2023-07-03 22:19:52 UTC
Permalink
Post by Hiroo Ono
Hello,
Also, vtraw2png have a bug that colors are not properly converted.
It is fixed now.
Post by Hiroo Ono
Post by Hiroo Ono
http://barleycorn.oikumene.net/ports-patch/
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Hiroo Ono
2023-07-03 20:26:28 UTC
Permalink
Hello,

I missed one point.
There is no fb image buffer for ttys not displayed, so vidcontrol -p raw
can only grab what you are seeing on the monitor, regardless of which tty
you specify.
Also, vtraw2png have a bug that colors are not properly converted.
Post by Hiroo Ono
http://barleycorn.oikumene.net/ports-patch/
Post by Hiroo Ono
Hello,
I made a patch to enable screenshot with vt(4). The patch is here.
https://reviews.freebsd.org/D40858
I would like to hear comments and reviews if it can be merged to FreeBSD.
When I mentioned it on mastodon, the patch lacked one file, sorry. ...
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Tomek CEDRO
2023-07-03 20:32:39 UTC
Permalink
Post by Hiroo Ono
Hello,
I made a patch to enable screenshot with vt(4). The patch is here.
https://reviews.freebsd.org/D40858
Very cool if this could be easily attached (but disabled by default)
to PrintScreen button and save terminal shot in some predefined
location (i.e. ~/.vt/screenshots/) :-)

There is also nice tool to record and share terminal sessions that I
use sometimes :-)

https://asciinema.org/
--
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...