我使用的系统是“Ubuntu 20.04.3 LTS”。我没有安装 Imagemagick。但是今天安装 Latex 后,它的图标在我的应用程序列表中。它与乳胶有关吗?为什么它未经许可就安装在我的系统上?
我想使用identify
命令(来自ImageMagick)来确定文件的类型。
示例命令
identify -quiet 'Sample File.gif'
将列出几行。有没有一种简单的方法来获取字符串GIF
?
我知道您可以通过转到/usr/share/applications/
、选择<appname>.desktop
和编辑来隐藏应用程序Hidden=true
。但是,在这种情况下,我在搜索的任何地方都找不到 imagemagick 的.desktop
文件!我非常想隐藏 Imagemagick,因为我不会使用它,但我无法卸载它,因为我正在使用的许多其他应用程序都将 Imagemagick 作为依赖项。那么,知道这个文件的位置吗?
我有点着急,所以我在这里问(我稍后会阅读文档)。
我有图像文件(宽度 1280,高度 720,彩色,jpg),我想首先将文件垂直和水平减少一半,到 640x360,我想剪切 120 行(上 60 行和下 60 行)到制作 640x240 彩色图像。我希望最终格式为 .ppm。
如何使用 ImageMagick 的convert
命令来做到这一点?
编辑:我发现我可以先使用另一个工具将图像尺寸减小到 640x360,然后我可以这样做:
convert -crop 640x240 filename.jpg filename_crop.jpg
裁剪较低的 120 行以获得 640x240 .jpg 文件。我至少可以使用其他工具(如 Web 服务)将它们转换为 .ppm 文件。但是 ImageMagick 的手册不是那么好。例如它说:
-define format:option
define one or more image format options
但什么也没说format:option
。
我正在尝试使用 install splashr,但遇到了一些依赖问题,似乎没有任何效果。我知道这与操作系统中的错误配置有关,而不是与软件包本身的问题有关,但也许你们可以提供一些指导。基本上在尝试安装 splashr 时,我得到以下日志:
> install.packages("splashr")
Installing package into ‘/home/guilherme/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependency ‘magick’
trying URL 'https://cloud.r-project.org/src/contrib/magick_2.5.0.tar.gz'
Content type 'application/x-gzip' length 4824979 bytes (4.6 MB)
==================================================
downloaded 4.6 MB
trying URL 'https://cloud.r-project.org/src/contrib/splashr_0.6.0.tar.gz'
Content type 'application/x-gzip' length 1099679 bytes (1.0 MB)
==================================================
downloaded 1.0 MB
* installing *source* package ‘magick’ ...
** package ‘magick’ successfully unpacked and MD5 sums checked
Package Magick++ was not found in the pkg-config search path.
Perhaps you should add the directory containing `Magick++.pc'
to the PKG_CONFIG_PATH environment variable
No package 'Magick++' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lMagick++-6.Q16
--------------------------- [ANTICONF] --------------------------------
Configuration failed to find the Magick++ library. Try installing:
- deb: libmagick++-dev (Debian, Ubuntu)
- rpm: ImageMagick-c++-devel (Fedora, CentOS, RHEL)
- csw: imagemagick_dev (Solaris)
- brew imagemagick@6 (MacOS)
For Ubuntu versions Trusty (14.04) and Xenial (16.04) use our PPA:
sudo add-apt-repository -y ppa:cran/imagemagick
sudo apt-get update
sudo apt-get install -y libmagick++-dev
If Magick++ is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a Magick++.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------- [ERROR MESSAGE] ---------------------------
<stdin>:1:10: fatal error: Magick++.h: No such file or directory
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘magick’
* removing ‘/home/guilherme/R/x86_64-pc-linux-gnu-library/3.4/magick’
Warning in install.packages :
installation of package ‘magick’ had non-zero exit status
ERROR: dependency ‘magick’ is not available for package ‘splashr’
* removing ‘/home/guilherme/R/x86_64-pc-linux-gnu-library/3.4/splashr’
Warning in install.packages :
installation of package ‘splashr’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmp8hJktb/downloaded_packages’
它抱怨没有找到 Magick++ 并导致它所依赖的包 magick 的另一个失败安装。输出类似:
> install.packages("magick")
Installing package into ‘/home/guilherme/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/magick_2.5.0.tar.gz'
Content type 'application/x-gzip' length 4824979 bytes (4.6 MB)
==================================================
downloaded 4.6 MB
* installing *source* package ‘magick’ ...
** package ‘magick’ successfully unpacked and MD5 sums checked
Package Magick++ was not found in the pkg-config search path.
Perhaps you should add the directory containing `Magick++.pc'
to the PKG_CONFIG_PATH environment variable
No package 'Magick++' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lMagick++-6.Q16
--------------------------- [ANTICONF] --------------------------------
Configuration failed to find the Magick++ library. Try installing:
- deb: libmagick++-dev (Debian, Ubuntu)
- rpm: ImageMagick-c++-devel (Fedora, CentOS, RHEL)
- csw: imagemagick_dev (Solaris)
- brew imagemagick@6 (MacOS)
For Ubuntu versions Trusty (14.04) and Xenial (16.04) use our PPA:
sudo add-apt-repository -y ppa:cran/imagemagick
sudo apt-get update
sudo apt-get install -y libmagick++-dev
If Magick++ is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a Magick++.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------- [ERROR MESSAGE] ---------------------------
<stdin>:1:10: fatal error: Magick++.h: No such file or directory
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘magick’
* removing ‘/home/guilherme/R/x86_64-pc-linux-gnu-library/3.4/magick’
Warning in install.packages :
installation of package ‘magick’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmp8hJktb/downloaded_packages’
所以我进入终端安装缺少的包 libmagick++-dev,但它也没有走远,因为它一直在询问依赖项的依赖关系:
以下软件包具有未满足的依赖关系: libmagick++-dev :依赖:libmagick++-6.q16-dev 但不会安装
依赖树还在继续:
libmagick++-dev
libmagick++-6.q16-dev
libmagickcore-6.q16-dev
libmagickwand-6.q16-dev
librsvg2-dev
libcairo2-dev
libfontconfig1-dev
libfontconfig1
由于错误,我无法安装它们中的任何一个:“......但它不会被安装”
我已经尝试多次卸载/安装 imagemagick 无济于事。
这些是有关环境变量的一些信息。
$PATH:
/home/guilherme/.local/share/umake/bin:/home/guilherme/bin:/home/guilherme/.local/share/umake/bin:/home/guilherme/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/guilherme/.config/composer/vendor/bin:bin/msys-ssh-1000-18:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/guilherme/.fzf/bin:/home/guilherme/.config/composer/vendor/bin
$PKG_CONFIG_PATH:(空)
lsb_release -a:
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic
我完全迷路了。谁能帮我这个?
编辑:
根据 N0rbert 的建议,这是输出apt-cache policy libmagick++-6.q16-dev
:
libmagick++-6.q16-dev:
Installed: (none)
Candidate: 8:6.9.7.4+dfsg-16ubuntu6.8
Version table:
8:6.9.7.4+dfsg-16ubuntu6.8 500
500 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
500 http://us.archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages
500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
8:6.9.7.4+dfsg-16ubuntu6 500
500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
TLDR:我搞砸了 Imagemagick 的安装,我正在尝试重新设置,这样当我输入 magick 时,它只会说,Command 'magick' not found...
而不是bash: /usr/local/bin/magick: No such file or directory
让我可以重新安装它sudo apt
全文:
我最近升级到 Ubuntu 20.04,在这个过程中,它似乎已经删除了 ImageMagick,所以我按照这里的说明重新安装它。一切都很好,直到我在这里也解释了问题。这些都不起作用,所以我进入了我的usr/local/lib
目录,只是删除了所有与 imageMagick 相关的内容(事后看来可能不聪明,但我认为因为我是从源代码安装的,所以我可以这样做)。
然后我尝试再次重复这个过程,它似乎让我回到了魔法可以工作但仍然存在相同的委托问题的地步,这一次我sudo make uninstall
在意识到它在 a 上可用后删除了它sudo apt install
(我一定只是输入了它我第一次尝试时错了)。
然而在这一点上,无论我在尝试打电话时做什么,我magick
都会得到bash: /usr/local/bin/magick: No such file or directory
有人可以帮助解释我哪里出错了,如果有办法完全撤销这一切?
当我运行时作为参考,sudo apt list imagemagick -a
这是我得到的:
imagemagick/focal-updates,focal-security,now 8:6.9.10.23+dfsg-2.1ubuntu11.1 amd64 [installed]
imagemagick/focal 8:6.9.10.23+dfsg-2.1ubuntu11 amd64
imagemagick/focal-updates,focal-security 8:6.9.10.23+dfsg-2.1ubuntu11.1 i386
imagemagick/focal 8:6.9.10.23+dfsg-2.1ubuntu11 i386
我对复杂的命令行东西不是很好,但对我来说这看起来像是以某种方式安装的?
我有来自 FLIR 相机的热图像,每个像素有 2 个字节。如果这些图像每个像素有 2 个字节,我不确定如何检查 Ubuntu。
另外,如何将每像素 2 字节的图像转换为每像素 1 字节的图像?
$ exiv2 frame0171.tiff
File name : frame0171.tiff
File size : 4194510 Bytes
MIME type : image/tiff
Image size : 1024 x 1024
Camera make :
Camera model :
Image timestamp :
Image number :
Exposure time :
Aperture :
Exposure bias :
Flash :
Flash bias :
Focal length :
Subject distance:
ISO speed :
Exposure mode :
Metering mode :
Macro mode :
Image quality :
Exif Resolution : 1024 x 1024
White balance :
Thumbnail : None
Copyright :
Exif comment :
$ file frame0171.tiff
frame0171.tiff: TIFF image data, little-endian, direntries=14, height=1024, bps=182, compression=none, PhotometricIntepretation=RGB, width=1024
$ exiv2 Rec-000026_16bit_counts.tif
File name : Rec-000026_16bit_counts.tif
File size : 2097433 Bytes
MIME type :
Image size : 0 x 0
Rec-000026_16bit_counts.tif: No Exif data found in the file
$ file Rec-000026_16bit_counts.tif
Rec-000026_16bit_counts.tif: Big TIFF image data, little-endian
$ exiv2 Rec-000026_tiff.tif
File name : Rec-000026_tiff.tif
File size : 1816013 Bytes
MIME type : image/tiff
Image size : 778 x 778
Camera make :
Camera model :
Image timestamp :
Image number :
Exposure time :
Aperture :
Exposure bias :
Flash :
Flash bias :
Focal length :
Subject distance:
ISO speed :
Exposure mode :
Metering mode :
Macro mode :
Image quality :
Exif Resolution : 778 x 778
White balance :
Thumbnail : None
Copyright :
Exif comment :
$ file Rec-000026_tiff.tif
Rec-000026_tiff.tif: TIFF image data, little-endian
在带有 Bitnami WordPress 堆栈的 Azure 上的 Ubuntu 18.04.4 LTS 上,我试图让 Imagemagick 和 Ghostscript 正常工作,以便 WordPress 将创建 PDF 缩略图。一个简单的转换测试会出错。当我搜索错误消息时,它们让我越来越深入地了解有关缺少库、手动添加符号链接、从源代码编译等的各种兔子洞。运行流行的图像转换程序似乎并不难。我错过了什么?
以下是版本和失败的测试:
/tmp$ sudo apt update
All packages are up to date.
/tmp$ sudo apt install imagemagick
imagemagick is already the newest version (8:6.9.7.4+dfsg-16ubuntu6.8).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
/tmp$ sudo apt install ghostscript
ghostscript is already the newest version (9.26~dfsg+0-0ubuntu0.18.04.12).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
/tmp$ which convert
/opt/bitnami/common/bin/convert
/tmp$ convert -version
Version: ImageMagick 6.9.8-3 Q16 x86_64 2019-04-03 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl png tiff wmf xml zlib
/tmp$ which ghostscript
/usr/bin/ghostscript
/tmp$ gs -version
GPL Ghostscript 9.26 (2018-11-20)
Copyright (C) 2018 Artifex Software, Inc. All rights reserved.
/tmp$ convert -verbose resume.pdf resume.jpg
'gs' -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r72x72' '-sOutputFile=/tmp/magick-38144ceME6-csnc4X%d' '-f/tmp/magick-38144tpfIz6n76qfI' '-f/tmp/magick-38144AH22zQfdNQqs'
gs: /opt/bitnami/common/lib/libtiff.so.5: no version information available (required by /usr/lib/x86_64-linux-gnu/libgs.so.9)
gs: symbol lookup error: /usr/lib/x86_64-linux-gnu/libgs.so.9: undefined symbol: FT_Property_Set
.convert.bin: no images defined `resume.jpg' @ error/convert.c/ConvertImageCommand/3258.
编辑按照评论中的要求:
~$ echo $LD_LIBARY_PATH
~$ ldd $(which conver)
ldd: missing file arguments
Try `ldd --help' for more information.
~$ ldd $(which convert)
not a dynamic executable
~$ ldd /usr/bin/ghostscript
linux-vdso.so.1 (0x00007fffc5be3000)
libgs.so.9 => /usr/lib/x86_64-linux-gnu/libgs.so.9 (0x00007f3614e95000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3614aa4000)
libtiff.so.5 => /usr/lib/x86_64-linux-gnu/libtiff.so.5 (0x00007f361482d000)
libcupsimage.so.2 => /usr/lib/x86_64-linux-gnu/libcupsimage.so.2 (0x00007f3614624000)
libcups.so.2 => /usr/lib/x86_64-linux-gnu/libcups.so.2 (0x00007f3614398000)
libijs-0.35.so => /usr/lib/x86_64-linux-gnu/libijs-0.35.so (0x00007f3614192000)
libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f3613f60000)
libjbig2dec.so.0 => /usr/lib/x86_64-linux-gnu/libjbig2dec.so.0 (0x00007f3613d48000)
libjpeg.so.8 => /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007f3613ae0000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f36138c3000)
liblcms2.so.2 => /usr/lib/x86_64-linux-gnu/liblcms2.so.2 (0x00007f361366b000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f36132cd000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f36130c9000)
libidn.so.11 => /lib/x86_64-linux-gnu/libidn.so.11 (0x00007f3612e96000)
libpaper.so.1 => /usr/lib/x86_64-linux-gnu/libpaper.so.1 (0x00007f3612c92000)
libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f3612a4d000)
libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f3612799000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f361257a000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3616241000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f3612354000)
libjbig.so.0 => /usr/lib/x86_64-linux-gnu/libjbig.so.0 (0x00007f3612146000)
libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007f3611efb000)
libgnutls.so.30 => /usr/lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007f3611b95000)
libavahi-common.so.3 => /usr/lib/x86_64-linux-gnu/libavahi-common.so.3 (0x00007f3611989000)
libavahi-client.so.3 => /usr/lib/x86_64-linux-gnu/libavahi-client.so.3 (0x00007f3611778000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f3611546000)
libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007f3611270000)
libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007f361103e000)
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f3610e3a000)
libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007f3610c2f000)
libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007f3610900000)
libidn2.so.0 => /usr/lib/x86_64-linux-gnu/libidn2.so.0 (0x00007f36106e3000)
libunistring.so.2 => /usr/lib/x86_64-linux-gnu/libunistring.so.2 (0x00007f3610365000)
libtasn1.so.6 => /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007f3610152000)
libnettle.so.6 => /usr/lib/x86_64-linux-gnu/libnettle.so.6 (0x00007f360ff1c000)
libhogweed.so.4 => /usr/lib/x86_64-linux-gnu/libhogweed.so.4 (0x00007f360fce8000)
libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f360fa67000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007f360f81a000)
libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007f360f616000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f360f3fb000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f360f1f3000)
libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007f360ef6f000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f360ed67000)
liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007f360eb4b000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007f360e82f000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f360e61a000)
我有默认情况下附带 ImageMagick 6.9.7 的 Ubuntu 18.04.1 LTS,我希望 ImageMagick 处理 jp2 图像,所以我安装了 libopenjp2-7-dev 并从源代码安装了 imagemagick7,如下所示:
wget https://www.imagemagick.org/download/ImageMagick.tar.gz
tar xvzf ImageMagick.tar.gz
cd ImageMagick-7.0.10-22
./configure
make
sudo make install
sudo ldconfig /usr/local/lib
magick -version
显示正确的:
Version: ImageMagick 7.0.10-22 Q16 x86_64 2020-07-02 https://imagemagick.org
Copyright: © 1999-2020 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(4.5)
Delegates (built-in): jng jp2 jpeg png xml zlib
但phpinfo()
其中显示:
imagick module version 3.4.4
imagick classes Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
Imagick using ImageMagick library version ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
我什至试图删除ImageMagick 6.9.7和PHP-Imagick扩展,我认为通过重新安装只有一个可用版本的扩展,它会以某种方式指向那个,但是如果没有 ImageMagick6 就无法安装扩展。我不知道如何让 PHP 使用 ImageMagick 7。