AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 962848
Accepted
bgoodr
bgoodr
Asked: 2017-10-08 07:48:05 +0800 CST2017-10-08 07:48:05 +0800 CST 2017-10-08 07:48:05 +0800 CST

ImageMagick:识别无法识别 XWD 图像

  • 772

我的目标是能够截取所有菜单的屏幕截图,无论工具提示或 X 窗口抓取下拉菜单,包括 Ubuntu 中的 sprocket 菜单,例如,像这样,并在另一个绘图工具(例如 Shutter)中注释它们:

截图1

我在 Shutter 之外执行此操作的方式(因为它实际上不会抓取该菜单,即使它正在做广告),xwd用于抓取整个根窗口,将其转换为 PNG 文件,将其加载到 Shutter 和然后裁剪下来。这样做非常浪费时间,但到目前为止它一直在工作,直到最近。

在 Ubuntu 上:

drunkard@norehab:~$ lsb_release -r -i
Distributor ID: Ubuntu
Release:    17.04

我使用以下方法截取完整的屏幕截图xwd:

drunkard@norehab:~$ xwd -root -out /tmp/xwd.tmp.6821
drunkard@norehab:~$ file /tmp/xwd.tmp.6821
/tmp/xwd.tmp.6821: XWD X Window Dump image data, "xwdump", 3840x1215x24

我在从 XWD 转换为 PNG 格式的过程中遇到了错误:

drunkard@norehab:~$ convert /tmp/xwd.tmp.6821 /home/drunkard/screenshot.2017-10-07.08-13-55.PDT.png
convert-im6.q16: no decode delegate for this image format `6821' @ error/constitute.c/ReadImage/504.
convert-im6.q16: no images defined `/home/drunkard/screenshot.2017-10-07.08-13-55.PDT.png' @ error/convert.c/ConvertImageCommand/3258.

我有这个版本的标识:

drunkard@norehab:~$ file /usr/bin/identify
/usr/bin/identify: symbolic link to /etc/alternatives/identify
drunkard@norehab:~$ readlink -f /etc/alternatives/identify
/usr/bin/identify-im6.q16
drunkard@norehab:~$ apt-file search /usr/bin/identify-im6.q16
imagemagick-6.q16: /usr/bin/identify-im6.q16
imagemagick-6.q16hdri: /usr/bin/identify-im6.q16hdri
drunkard@norehab:~$ dpkg --listfiles imagemagick-6.q16 | grep identify
/usr/bin/identify-im6.q16
/usr/share/man/man1/identify-im6.q16.1.gz
drunkard@norehab:~$ apt-cache --no-all-versions show imagemagick-6.q16 
Package: imagemagick-6.q16
Architecture: amd64
Version: 8:6.9.7.4+dfsg-3ubuntu1.2
Multi-Arch: foreign
Priority: optional
Section: graphics
Source: imagemagick
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: ImageMagick Packaging Team <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 644
Provides: imagemagick, imagemagick-6.defaultquantum
Depends: libc6 (>= 2.4), libmagickcore-6.q16-3 (>= 8:6.9.6.8), libmagickwand-6.q16-3 (>= 8:6.9.6.8), hicolor-icon-theme
Recommends: libmagickcore-6.q16-3-extra, ghostscript, netpbm
Suggests: imagemagick-doc, autotrace, cups-bsd | lpr | lprng, curl, enscript, ffmpeg, gimp, gnuplot, grads, graphviz, groff-base, hp2xx, html2ps, libwmf-bin, mplayer, povray, radiance, sane-utils, texlive-base-bin, transfig, ufraw-batch, xdg-utils
Breaks: libmagickcore-dev (<< 8:6.9.2.10+dfsg-2~)
Replaces: imagemagick (<< 8:6.9.2.10+dfsg-2~)
Filename: pool/main/i/imagemagick/imagemagick-6.q16_6.9.7.4+dfsg-3ubuntu1.2_amd64.deb
Size: 423848
MD5sum: 6f06b63767fb5e32d967e4395d4e4f98
SHA1: ba0b8af93fed0e9d1efabe56e79387f1bc4944e5
SHA256: 84ffd5f3eb1c8bdc11955c581fc98f1c1bb37eb40609ef6997c8675f1dfd29d0
Homepage: http://www.imagemagick.org/
Description-en: image manipulation programs -- quantum depth Q16
 ImageMagick is a software suite to create, edit, and compose bitmap images.
 It can read, convert and write images in a variety of formats (over 100)
 including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript,
 SVG, and TIFF. Use ImageMagick to translate, flip, mirror, rotate, scale,
 shear and transform images, adjust image colors, apply various special
 effects, or draw text, lines, polygons, ellipses and Bézier curves.
 All manipulations can be achieved through shell commands as well as through
 an X11 graphical interface (display).
 .
 For working with the SVG, WMF, OpenEXR, DjVu and Graphviz formats,
 you need to install the libmagickcore-6.q16-3-extra package.
 .
 This version of imagemagick is compiled for a channel
 depth of 16 bits (Q16).
Description-md5: e40daf0bbbffd2b9ac49e04c8c3480fe
Task: ubuntu-desktop, ubuntu-usb, print-server, kubuntu-desktop, edubuntu-desktop, edubuntu-usb, xubuntu-core, xubuntu-desktop, mythbuntu-desktop, lubuntu-desktop-share, lubuntu-gtk-desktop, lubuntu-desktop, lubuntu-qt-desktop, ubuntustudio-desktop-core, ubuntustudio-desktop, ubuntu-gnome-desktop, ubuntukylin-desktop, ubuntu-mate-core, ubuntu-mate-desktop, ubuntu-budgie-desktop
Supported: 9m

N: There is 1 additional record. Please use the '-a' switch to see it

但是Identify无法识别:

drunkard@norehab:~$ identify /tmp/xwd.tmp.6821
identify-im6.q16: no decode delegate for this image format `6821' @ error/constitute.c/ReadImage/504.

这曾经奏效。

imagemagick
  • 2 2 个回答
  • 1739 Views

2 个回答

  • Voted
  1. Best Answer
    andrew.46
    2017-10-14T15:39:38+08:002017-10-14T15:39:38+08:00

    解决这个可能的限制的一种简单方法imagemagick是稍微改变抓取屏幕截图的技术。而不是使用您当前的两步技术:

    1. 抓取屏幕截图xwd
    2. 转换为imagemagick

    使用“管道”使进程成为单个命令:

    xwd -root | convert xwd:- test.png
    

    这在我的系统上运行良好,可以解决您遇到的问题。我使用这种技术输入这个答案的截图(裁剪了一个小帖子截图):

    在此处输入图像描述

    xwd在下面的参考资料中有更多用于此目的的想法......

    参考:

    • HowTo:使用 xwd 截屏
    • 2
  2. bgoodr
    2017-10-08T07:49:16+08:002017-10-08T07:49:16+08:00

    给它一个.xwd文件扩展名:

    drunkard@norehab:~$ cp /tmp/xwd.tmp.6821 /tmp/xwd.tmp.6821.xwd
    drunkard@norehab:~$ identify /tmp/xwd.tmp.6821.xwd
    /tmp/xwd.tmp.6821.xwd XWD 3840x1215 3840x1215+0+0 8-bit sRGB 18.67MB 0.000u 0:00.009
    

    所以这过去不需要.xwd文件扩展名就可以工作。因此,我认为这是一个错误,或者是用户错误,因为我期望它本来应该可以工作,但是无论文件命名如何,identify识别图像内容的重点不就是吗?

    • 0

相关问题

  • 从控制台修改多个图像[重复]

  • 蒙太奇中的图像映射(每个图像都是一个超链接)

  • 将图像从灰度转换为二进制

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve