Images: Difference between revisions
(Created page with "= Convert a color image to black and white = * https://linux.cn/article-8851-1.html * https://www.imagemagick.org/script/command-line-options.php#canny <pre> $ convert filena...") |
|||
Line 70: | Line 70: | ||
= Convert an image to sketch (online tool) = | = Convert an image to sketch (online tool) = | ||
http://www.snapstouch.com/sketch.aspx | * http://www.snapstouch.com/sketch.aspx | ||
* [http://www.fmwconcepts.com/imagemagick/sketch/index.php Fred's ImageMagick Scripts] | |||
= Convert an image file to a different format (eg icon) = | = Convert an image file to a different format (eg icon) = |
Revision as of 08:48, 7 November 2019
Convert a color image to black and white
- https://linux.cn/article-8851-1.html
- https://www.imagemagick.org/script/command-line-options.php#canny
$ convert filename.jpg -canny 0x1 -negate canny.jpg convert.im6: unrecognized option `-canny' @ error/convert.c/ConvertImageCommand/1107. $ convert --version Version: ImageMagick 6.7.7-10 2017-07-31 Q16 http://www.imagemagick.org Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC Features: OpenMP
The current imagemagick version is 7.0.7-15.
Install/build the latest imagemagick
- https://www.imagemagick.org/script/install-source.php
- https://gist.github.com/makenova/78bb63aaa1050e2ad8019ee1e7e7b433
- https://www.tutorialspoint.com/articles/how-to-install-imagemagick-on-ubuntu
# remove version installed with apt-get sudo apt-get remove imagemagick && sudo apt-get autoremove # install dependencies sudo apt-get install build-essential sudo apt-get build-dep imagemagick -y # download ImageMagick source wget http://www.imagemagick.org/download/ImageMagick.tar.gz tar xzvf ImageMagick.tar.gz # build source cd ImageMagick-* ./configure make # install and verify sudo make install sudo checkinstall ********************************************************************** Done. The new package has been installed and saved to /home/XXX/Downloads/ImageMagick-7.0.7-15/imagemagick-7.0.7_15-1_amd64.deb You can remove it from your system anytime using: dpkg -r imagemagick-7.0.7 ********************************************************************** $ convert --version # bash: /usr/bin/convert: No such file or directory $ which convert /usr/local/bin/convert $ whereis convert convert: /usr/local/bin/convert $ /usr/local/bin/convert -version Version: ImageMagick 7.0.7-15 Q16 x86_64 2017-12-20 http://www.imagemagick.org Copyright: © 1999-2018 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC HDRI OpenMP Delegates (built-in): bzlib fontconfig freetype jbig jng jpeg lzma pangocairo png tiff x xml zlib
Convert an image to sketch (online tool)
Convert an image file to a different format (eg icon)
Using the imagemagic program.
convert winamp-ncrow.png -resize 32x32 winamp-ncrow.ico
4 Ways to Batch Convert Your PNG to JPG and Vice-Versa
Rotate an image
http://www.imagemagick.org/script/command-line-options.php#rotate
convert winamp-ncrow.png -rotate 45 winamp-ncrow2.png # 45 degrees
One problem with this simple approach is the picture size (not image file) changed (become smaller) if the degree is not one of 90,180 or 270.
Create an animated gif file
Use the script here. See the last example on here. The rotation speed looks good too! Just change the source image file in the script.
#!/bin/sh # # Create a rotating figure using Distort SRT transformations # command='convert -delay 10 koala.gif -virtual-pixel white' for i in `seq 5 5 360`; do command="$command \\( -clone 0 -distort SRT $i \\)" done command="$command -delete 0 -loop 0 animate_distort_rot.gif" eval $command chmod 644 animate_distort_rot.gif
Tool to convert a sequence of numbered PNG files to an animated GIF?. Convert command line option. The option '-loop 0' means repeats infinitely and '-delay 200' means 2 seconds delay between each frame.
convert -delay 200 -loop 0 file_1.png file_2.png file_3.png animated.gif
Convert Video to GIF
The Best Ways to Convert Video to GIF
Edit gif file
gifsicle package
Replace transparency in PNG images with white background
http://stackoverflow.com/questions/2322750/replace-transparency-in-png-images-with-white-background
convert image.png -background white -alpha remove white.png
Remove GPS metadata from jpg files - exiftool
sudo apt-get install libimage-exiftool-perl exiftool -gps:all= -xmp:geotag= image.jpg
The image file will be updated. To check the current metadata, use
exiftool image.jpg
Note that the above command only remove gps information. The other information like date/time of creation, camera model are not changed.
Exitftool can also be used to edit the metadata on PDF files.
exiftool -Title="This is the Title" -Author="Happy Man" -Subject="PDF Metadata" drawing.pdf
An R package exifr also available on CRAN.
Edit Svg image
- Inkscape
- Inkscape from Fedora magazine
Animated gif
- How to generate a animated GIF or movie out of images on Linux (GIMP or PhotoFilmStrip)
- convert (.gif to .png) this image to get the original view? (ImageMagick)