Difference between revisions of "Loops"
From Steak Wiki
Jump to navigationJump to searchLine 20: | Line 20: | ||
</pre> | </pre> | ||
Basically, trim off extension of i, put into name. Use both for extractions/conversion. | Basically, trim off extension of i, put into name. Use both for extractions/conversion. | ||
+ | |||
+ | ===Edit images in bulk=== | ||
+ | <pre> | ||
+ | |||
+ | for i in *.JPG | ||
+ | do | ||
+ | #delete exif data | ||
+ | mogrify -strip $i | ||
+ | #test convert size in gimp first to get ratio right. My source files are 4kx3.5k | ||
+ | convert -resize 1080x810 $i ~/Desktop/phatch/$i | ||
+ | done | ||
+ | </pre> | ||
* https://hackaday.com/2020/06/12/binary-math-tricks-shifting-to-divide-by-ten-aint-easy/ | * https://hackaday.com/2020/06/12/binary-math-tricks-shifting-to-divide-by-ten-aint-easy/ |
Revision as of 04:52, 28 October 2020
This is a basic (bash) loop to operate on files.
Examples are given for 7z and video conversion.
#!/bin/bash -x #for i in *.webm; for i in *.7z do name=`echo $i | cut -d'.' -f1`; echo $name; #for h264 # ffmpeg -i $i -s 1280x720 -c:a copy $name.mp4; #for webm #-map_metadata -1 is to remove metadata, at least try to remove some. (need to verify) #ffmpeg -i $i -map_metadata -1 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis $name.webm 7z e -o"$name" ./"$i" done
Basically, trim off extension of i, put into name. Use both for extractions/conversion.
Edit images in bulk
for i in *.JPG do #delete exif data mogrify -strip $i #test convert size in gimp first to get ratio right. My source files are 4kx3.5k convert -resize 1080x810 $i ~/Desktop/phatch/$i done