imagemagick
linux-shell: renaming files to creation time
Naming based on file system date In the linux shell: for f in *.jpg do mv -n “$f” “$(date -r “$f” +”%Y%m%d_%H%M%S”).jpg” done Explanation: for f in *.jpg do This starts the loop over all jpeg files. A feature of this is that it will work with all file names, even ones with spaces, tabs … Read more
ImageMagick: how to minimally crop an image to a certain aspect ratio?
Imagemagick 7.0.7.22 and above -crop 3:2 works since January 6th, 2018. JPG magick convert in.jpg -gravity center -crop 3:2 out.jpg Warning/reminder: if you don’t use -gravity center, you will get two output files: PNG As fmw42 points out, PNG files store the virtual canvas size. +repage is recommended. magick convert in.png -gravity center -crop 3:2 … Read more
Recipe for creating Windows ICO files with ImageMagick?
ImageMagick has a recipe for this in their documentation, see FavIcon Web Page Link Thumbnail Essentially you run the following: convert image.png -bordercolor white -border 0 \ \( -clone 0 -resize 16×16 \) \ \( -clone 0 -resize 32×32 \) \ \( -clone 0 -resize 48×48 \) \ \( -clone 0 -resize 64×64 \) \ … Read more
Documents and examples of PythonMagick
I could not find them anywhere either but this is how I went about using it anyway. Example import PythonMagick image = PythonMagick.Image(“sample_image.jpg”) print image.fileName() print image.magick() print image.size().width() print image.size().height() With output like this sample_image.jpg JPEG 345 229 To find out what image methods are available for example I looked in the cpp source. … Read more
Can’t install imagemagick with brew on Mac OS X mavericks
Have you tried a $ brew update $ brew install imagemagick –disable-openmp –build-from-source Apparently that seemed to fix it for me on Mac OS 10.8 (Mountain Lion). Previously I checked out the latest imagemagick brew recipe with “brew versions imagemagick” and “git checkout e68e443”, see here and here
ImageMagick command to convert and save with same name
Another way: convert *.jpg -resize 80% -set filename:f ‘%t’ ../’%[filename:f].jpg’ Will place converted files in the folder above. The option -set filename:f ‘%t’ sets the property filename:f to the current filename without the extension. Properties beginning with filename: are a special case that can be referenced in the output filename. Here we set it to … Read more