写真サイズ変更などを実現するのは、ImageMagicというツールの一つプログラムです。
CentOS(RedHat系)やUbuntu(Debian系)などのLinuxとも使えます。現在2023/7時点で、バージョン「6.9.11」が使えるようですが、最後の更新は2021年だったようです。
1.インストール
このソフトをCentOSとUbuntuでそれぞれのインストール仕方を下記通りメモします。
CentOS
♯ sudo yum -y install ImageMagickUbuntu
$ sudo apt-get install imagemagickインストールするソフトはImageMagickですが、写真編集に使うコマンドは「Convert」となります。
$ which convert/usr/bin/convert$ convert --versionVersion: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.orgCopyright: (C) 1999-2021 ImageMagick Studio LLCLicense: https://imagemagick.org/script/license.phpFeatures: Cipher DPC Modules OpenMP(4.5)Delegates (built-in): bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib2.写真サイズ変更
convertコマンドの機能は結構豊富です。サイズ変更は、以下のように実行すればよいです。詳細はman convertで調べてください。
$ convert -resize 160x picture_a.jpg picture_b.jpgちなみに、man convertで調べた結果の一部は以下となります。
$ man convertNAME convert - convert between image formats as well as resize an image, blur, crop, de- speckle, dither, draw on, flip, join, re-sample, and much more.SYNOPSIS convert-im6.q16 [input-option] input-file [output-option] output-fileOVERVIEW The convert-im6.q16 program is a member of the ImageMagick-ims6.q16(1) suite of tools. Use it to convert between image formats as well as resize an image, blur, crop, de- speckle, dither, draw on, flip, join, re-sample, and much more. For more information about the convert command, point your browser to file:///usr/share/doc/imagemagick-6-common/html/www/convert.html (on debian system you may install the imagemagick-6 package) or https://www.imagemagick.org/script/convert.php.3.実行例
左側「orignal.png」は編集対象写真で、右側「out.png」は編集後写真です。
実行したコマンドは以下となります。
$ convert -resize 160x orignal.png out.png
4.参照URL
0 件のコメント:
コメントを投稿