Sunday, August 26, 2018

ImageMagick

I am a fan.  I know about less than 1% of its features but enough to admire the software and all that comes with it.

Tried to upgrade to 7.  What a challenge.  My MacPorts was outdated.  I think I installed IM via Ports.  So I tried to do it via Ports once again.   When Ports was done upgraded or actually migrated to High Sierra I was all set to upgrade to the latest greatest IM, sure I guess I could have used a much older version but.   Alas, the Ports port was still 6.9.  After going through an entire day, I was back to step 1.  I was thinking to use Home Brew to update, now I finally had enough.  I updated my Brew, not a migration mind you.   So nothing too abstruse to follow except to remove a couple of paths.  I was on 7 but the display program doesn't work.  Instead of tweaking tweaking and tweaking the path, I found another guy saying just to uninstall and brew install with X11 explicitly.  And it finally works.  Everything.  I tested my old scripts and it works too.

I modified my script to do Instagram as well.  I know so little IM and shell scripting so the script is kind of a patch work, but it works somewhat.

if [ ! -d "./ig" ]; then mkdir "./ig"; fi

for j in *.JPG
do
echo " ... instagramming $j"
test=`convert $j -format "%[fx:(w/h>1)?1:0]" info:`
if [ $test -eq 1 ]; then
convert "$j" \
    -resize 1080x566 \
    -background white \
    -gravity center \
    -extent 1080x566 "./ig/ig$j"
  else
    convert "$j" \
        -resize 1080x1350 \
        -background white \
        -gravity center \
        -extent 1080x1350 "./ig/ig$j"
fi
done


IM 7 uses 'magick' instead of 'convert' but convert apparently still works.

I need to shore up my shell scripting skill.

I purposely distracted myself installing IM yesterday.  I lost GIMP when I migrated MacPorts.  Oh well.  I don't really use it anymore as since I pay for LR.

UPDATE: 8/28/2018
I corrected the script, the portrait mode should be 1080x1350, wxh.

No comments:

Post a Comment

Barber Shop in Chinatown

 Nowadays I loathe to have my haircut, that's why I seldom have mine cut, maybe once or twice a year. I went back to Chinatown. I could ...