Created
September 10, 2013 10:03
-
-
Save jmfayard/6507384 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MacbookPro-JMF in ~/Downloads | |
○ → cp -rv fwdnotasescaneadas fwdnotasescaneadas.copie | |
fwdnotasescaneadas -> fwdnotasescaneadas.copie/fwdnotasescaneadas | |
fwdnotasescaneadas/img305.jpg -> fwdnotasescaneadas.copie/fwdnotasescaneadas/img305.jpg | |
fwdnotasescaneadas/img306.jpg -> fwdnotasescaneadas.copie/fwdnotasescaneadas/img306.jpg | |
fwdnotasescaneadas/img307.jpg -> fwdnotasescaneadas.copie/fwdnotasescaneadas/img307.jpg | |
fwdnotasescaneadas/img308.jpg -> fwdnotasescaneadas.copie/fwdnotasescaneadas/img308.jpg | |
fwdnotasescaneadas/img309.jpg -> fwdnotasescaneadas.copie/fwdnotasescaneadas/img309.jpg | |
fwdnotasescaneadas/img310.jpg -> fwdnotasescaneadas.copie/fwdnotasescaneadas/img310.jpg | |
MacbookPro-JMF in ~/Downloads | |
○ → cd fwdnotasescaneadas | |
MacbookPro-JMF in ~/Downloads/fwdnotasescaneadas | |
○ → ls | |
img305.jpg img306.jpg img307.jpg img308.jpg img309.jpg img310.jpg | |
MacbookPro-JMF in ~/Downloads/fwdnotasescaneadas | |
○ → cp img305.jpg a.jpg | |
# So, if I remember well, the basic syntax is very simple | |
MacbookPro-JMF in ~/Downloads/fwdnotasescaneadas | |
○ → convert a.jpeg a-badquility.jpeg | |
-bash: convert: command not found | |
# Yeah, of course, ImageMagick is not installed on macosx | |
# Luckily the good guys from HomeBrew built the OSX's missing package manager | |
MacbookPro-JMF in ~/Downloads/fwdnotasescaneadas | |
○ → brew install imagemagick | |
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/imagemagick-6.8.6-3.mountain_lion.bottle.tar.gz | |
######################################################################## 100,0% | |
==> Pouring imagemagick-6.8.6-3.mountain_lion.bottle.tar.gz | |
🍺 /usr/local/Cellar/imagemagick/6.8.6-3: 1429 files, 20M | |
MacbookPro-JMF in ~/Downloads/fwdnotasescaneadas | |
○ → convert a.jpg a-badquality.jpg | |
# Great, "First, do no wrong" is respected | |
# Now make something useful out of it | |
# Google and Stackoverflue to the rescue | |
MacbookPro-JMF in ~/Downloads/fwdnotasescaneadas | |
○ → convert -strip -interlace Plane -gaussian-blur 0.05 -quality 85% a.jpg a-badquality.jpg | |
MacbookPro-JMF in ~/Downloads/fwdnotasescaneadas | |
○ → ls -lh a*.jpg | |
total 15976 | |
-rw-r--r-- 1 jmfayard staff 673K 8 sep 22:44 a-badquality.jpg | |
-rwxr-xr-x@ 1 jmfayard staff 964K 8 sep 22:43 a.jpg | |
# Wow, this crappy website really wants crappy images | |
# Well, I will not waste my time to tell dumb people they should become clever | |
# If they are ok with crappy images, just give them crappy images | |
MacbookPro-JMF in ~/Downloads/fwdnotasescaneadas | |
○ → convert -strip -interlace Plane -gaussian-blur 0.05 -quality 35% a.jpg a-badquality.jpg | |
MacbookPro-JMF in ~/Downloads/fwdnotasescaneadas | |
○ → ls -lh a*.jpg | |
total 15976 | |
-rw-r--r-- 1 jmfayard staff 270K 8 sep 22:44 a-badquality.jpg | |
-rwxr-xr-x@ 1 jmfayard staff 964K 8 sep 22:43 a.jpg | |
# Less than 300K, perfect | |
# Let's be sure that I remember that weird "for" syntax well | |
MacbookPro-JMF in ~/Downloads/fwdnotasescaneadas | |
○ → for i in *jpg ; do echo convert -strip -interlace Plane -gaussian-blur 0.05 -quality 30% $i ${i/.jpg/-badquality.jpg} ; done | |
convert -strip -interlace Plane -gaussian-blur 0.05 -quality 30% img305.jpg img305-badquality.jpg | |
convert -strip -interlace Plane -gaussian-blur 0.05 -quality 30% img306.jpg img306-badquality.jpg | |
convert -strip -interlace Plane -gaussian-blur 0.05 -quality 30% img307.jpg img307-badquality.jpg | |
convert -strip -interlace Plane -gaussian-blur 0.05 -quality 30% img308.jpg img308-badquality.jpg | |
convert -strip -interlace Plane -gaussian-blur 0.05 -quality 30% img309.jpg img309-badquality.jpg | |
convert -strip -interlace Plane -gaussian-blur 0.05 -quality 30% img310.jpg img310-badquality.jpg | |
# Great ! | |
# Now remove that "echo" thing ;-) | |
MacbookPro-JMF in ~/Downloads/fwdnotasescaneadas | |
○ → for i in *jpg ; do convert -strip -interlace Plane -gaussian-blur 0.05 -quality 30% $i ${i/.jpg/-badquality.jpg} ; done | |
MacbookPro-JMF in ~/Downloads/fwdnotasescaneadas | |
○ → ls -lh | |
total 15792 | |
-rw-r--r-- 1 jmfayard staff 266K 8 sep 22:51 img305-badquality.jpg | |
-rwxr-xr-x@ 1 jmfayard staff 964K 8 sep 21:28 img305.jpg | |
-rw-r--r-- 1 jmfayard staff 252K 8 sep 22:51 img306-badquality.jpg | |
-rwxr-xr-x@ 1 jmfayard staff 1,0M 8 sep 21:28 img306.jpg | |
-rw-r--r-- 1 jmfayard staff 235K 8 sep 22:51 img307-badquality.jpg | |
-rwxr-xr-x@ 1 jmfayard staff 1,0M 8 sep 21:28 img307.jpg | |
-rw-r--r-- 1 jmfayard staff 272K 8 sep 22:51 img308-badquality.jpg | |
-rwxr-xr-x@ 1 jmfayard staff 1,1M 8 sep 21:28 img308.jpg | |
-rw-r--r-- 1 jmfayard staff 270K 8 sep 22:51 img309-badquality.jpg | |
-rwxr-xr-x@ 1 jmfayard staff 1,1M 8 sep 21:28 img309.jpg | |
-rw-r--r-- 1 jmfayard staff 251K 8 sep 22:51 img310-badquality.jpg | |
-rwxr-xr-x@ 1 jmfayard staff 1,0M 8 sep 21:28 img310.jpg | |
MacbookPro-JMF in ~/Downloads/fwdnotasescaneadas | |
○ → open *badquality.jpg | |
Many Thanks to : | |
- ImageMagick http://www.imagemagick.org/script/index.php | |
- HomeBrew http://brew.sh/ | |
- StackOverflow http://stackoverflow.com/questions/7261855/recommendation-for-compress-jpg-files-with-image-magick | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment