拍摄嵌入式 Linux 帧缓冲区的屏幕截图

发布于 2024-08-09 13:06:33 字数 356 浏览 1 评论 0原文

我在评估套件(Zoom OMAP35x Torpedo 开发套件)上运行嵌入式 Linux。该板有一个 LCD,我希望能够拍摄屏幕截图并将其转换为 gif 或 png。我可以通过执行以下操作来获取原始数据:“cp /dev/fb0 screen.raw”,但我对如何将图像转换为 gif 或 png 格式感到困惑。

我尝试使用 ImageMagick 的转换(例如:“convert -depth 8 -size 240x320 rgb:./screen.raw -swap 0,2 -separate -combine screen.png”),但无法获得看起来像的图像正确的。

有谁知道我可以尝试其他任何工具吗?或者有人有使用 ImageMagick 的技巧吗?

I'm running Embedded Linux on an evaluation kit (Zoom OMAP35x Torpedo Development Kit). The board has an LCD and I would like to be able to take screen shots convert them into a gif or png. I can get the raw data by doing the following: "cp /dev/fb0 screen.raw", but I am stumped on how to convert the image into a gif or png format.

I played around with convert from ImageMagick (example: "convert -depth 8 -size 240x320 rgb:./screen.raw -swap 0,2 -separate -combine screen.png"), but have been unable to get an image that looks right.

Does anyone know of any other tools that I could try out? Or does anyone have tips for using ImageMagick?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

南笙 2024-08-16 13:06:33

看一下fbgrab,一个可以完成此任务的应用程序(它将帧缓冲区内容保存为 png)。

Take a look at fbgrab, an application that does just that (it saves the framebuffer content as a png).

手心的温暖 2024-08-16 13:06:33

您可以简单地将帧缓冲区捕获到文件中并在任何原始图像查看器中打开它或在线尝试,例如: https://rawpixels.net/

cat /dev/fb0 > fbdump

You can simply capture the framebuffer to a file and open it in any raw image viewer or try online eg: https://rawpixels.net/

cat /dev/fb0 > fbdump
夏了南城 2024-08-16 13:06:33

直接使用 ImageMagick 可能不太可能/很容易做到这一点。

Linux 内核 4.2 文档 https://github。 com/torvalds/linux/blob/v4.2/Documentation/fb/api.txt#45 说:

像素以与硬件相关的格式存储在内存中。应用需要
了解像素存储格式以便将图像数据写入
帧缓冲存储器采用硬件期望的格式。

格式由帧缓冲区类型和视觉效果来描述。有些视觉效果需要
附加信息,存储在可变屏幕信息中
bits_per_pixel、灰度、红色、绿色、蓝色和 transp 字段。

视觉效果描述了颜色信息如何编码和组合以创建
宏像素。类型描述了宏像素如何存储在内存中。支持以下类型和视觉效果。

下面是视觉效果和类型的列表,但描述不足以让我立即理解确切的格式。

但它似乎可能不是 ImageMagick 直接理解的格式,或者至少您必须找出使用的格式来决定 ImageMagick 选项。

It might not be possible / easy to do it directly with ImageMagick.

The Linux kernel 4.2 documentation https://github.com/torvalds/linux/blob/v4.2/Documentation/fb/api.txt#45 says:

Pixels are stored in memory in hardware-dependent formats. Applications need
to be aware of the pixel storage format in order to write image data to the
frame buffer memory in the format expected by the hardware.

Formats are described by frame buffer types and visuals. Some visuals require
additional information, which are stored in the variable screen information
bits_per_pixel, grayscale, red, green, blue and transp fields.

Visuals describe how color information is encoded and assembled to create
macropixels. Types describe how macropixels are stored in memory. The following types and visuals are supported.

A list of visuals and types follows, but the description is not enough for me to understand the exact formats immediately.

But it seems likely that it might not be a format that ImageMagick will understand directly, or at least you'd have to find out the used format to decide the ImageMagick options.

淡看悲欢离合 2024-08-16 13:06:33

只需使用 cat 即可获取原始帧缓冲区数据

cat /dev/fb0 > fbdump.data

请注意,这是帧缓冲区设置的本机格式。

要转换它,ffmpeg 很有用。请记住使用 -s 设置大小,并使用 -pix_fmt 设置像素格式

ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb32 -s 800x480 -i fbdump.data -f image2 -vcodec png snapshot.png

您还可以在 gimp 中打开 .data 文件,但格式选项更有限。

最后,您还可以使用 fbgrab 获取屏幕截图并直接转换为 png 格式。也就是说,如果您的嵌入式目标有它。

fbgrab -d /dev/fb0 截图.png

Simply use cat to get the raw frame buffer data

cat /dev/fb0 > fbdump.data

Note that this is in the native format of whatever your frame buffer is set to.

To convert it ffmpeg is useful. Remember to set the size with -s and the pixel format with -pix_fmt

ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb32 -s 800x480 -i fbdump.data -f image2 -vcodec png screenshot.png

You can also open .data files in gimp but the format options are more limited.

lastly you can also use fbgrab to get a screenshot and convert directly to png format. That is, if your embedded target has it.

fbgrab -d /dev/fb0 screenshot.png

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文