I know convert
changes from one image format to another. mogrify
can resize and scale multiple images also. But how can I modify all images inside a directory, including the sub-directories. Like for example change every image inside a folder and its sub-folders from one format png to another format jpg, or resize all pictures in a folder and its sub-folders to a desire one?
Since mogrify accepts a list of files, separated by line breaks, you can do this:
I use equalize as an example, but the important bit is the last one.
find -iname '*.png'
as an example. You can play around with thefind
command until it give you the list of files you want.It's important that whatever command you put in
$()
returns a list of files with their correct path.ls -Ra
will just return the file name. The output offind | grep png
on the other hand looks like this:Where
.
means "the current working directory".