Hello, i have found the command i need, but i need an option more.
for file in *.jpg; do convert $file -resize 1000x1000\> $file; done
I want it not process with file who is not resized, with this command it process with it even if the dimension don't change (but file size change)...
If i do this everyday in the same folder, the file who will not be redimensionned will lost quality day after day...
Thank you very much.
Process File only if Dimension Change
-
snibgo
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
- Contact:
Re: Process File only if Dimension Change
Do that option in the script, outside the convert, and probably outside the "for" loop.PoOoOoZ wrote:Hello, i have found the command i need, but i need an option more.
For example, don't do this every day in the same folder. Organise your process so you do the resize only once per file.
snibgo's IM pages: im.snibgo.com
Re: Process File only if Dimension Change
I was looking for a thing like this :
for files in *.jpg
do
echo $files
filesizecurrent=$(wc -c <"$files")
echo $filesizecurrent
if [ $filesizecurrent -ge 100000 ]
then
echo "BIG FILE"
convert $file -resize 1000x1000\> $file
continue
fi
echo "LITTLE FILE"
done
for files in *.jpg
do
echo $files
filesizecurrent=$(wc -c <"$files")
echo $filesizecurrent
if [ $filesizecurrent -ge 100000 ]
then
echo "BIG FILE"
convert $file -resize 1000x1000\> $file
continue
fi
echo "LITTLE FILE"
done
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
- Contact:
Re: Process File only if Dimension Change
You can use ImageMagick to obtain the dimensions of an image with a command like this...PoOoOoZ wrote:I was looking for a thing like this :
Code: Select all
convert -ping image.jpg -format "%[w]x%[h]" info:To get any more detailed help you need to let us know what version of ImageMagick you're using, and what platform or shell, you're running this from.
Who is online
Users browsing this forum: Google [Bot] and 1 guest