Search code examples
terminaljpeghomebrewgraphicsmagick

Newbie difficulties with graphicsmagick and jpeg decode delegates


I am having difficulty trying to get graphicsmagick to work. New to the coding world =]

I think I might have botched up my installation by not using brew to install.

I have an image on my /Desktop; 'sign.jpeg'

Here's what I get when I try to identify (or resize) the image:

Admins-iMac:Desktop admin$ gm identify sign.jpeg
gm identify: No decode delegate for this image format (sign.jpeg).
gm identify: Request did not return an image.

So I guess I will try unlinking and relinking:

Admins-iMac:Desktop admin$ brew unlink jpeg
Unlinking /usr/local/Cellar/jpeg/9b... 17 symlinks removed

Admins-iMac:Desktop admin$ brew link jpeg
Linking /usr/local/Cellar/jpeg/9b... 17 symlinks created

Hmm:

Admins-iMac:Desktop admin$ brew info jpeg
jpeg: stable 9b (bottled)
Image manipulation library
http://www.ijg.org
/usr/local/Cellar/jpeg/9b (20 files, 724KB) *
  Poured from bottle on 2018-01-11 at 10:48:47
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/jpeg.rb

Alright so I guess I will try un/reinstalling graphicsmagick:

Admins-iMac:Desktop admin$ brew uninstall imagemagick graphicsmagick libpng jpeg
Error: No such keg: /usr/local/Cellar/imagemagick

Let me check the version info:

Admins-iMac:Desktop admin$ gm -version
GraphicsMagick 1.3.27  Q8 http://www.GraphicsMagick.org/
Copyright (C) 2002-2017 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.

Feature Support:
  Native Thread Safe       yes
  Large Files (> 32 bit)   yes
  Large Memory (> 32 bit)  yes
  BZIP                     yes
  DPS                      no
  FlashPix                 no
  FreeType                 no
  Ghostscript (Library)    no
  JBIG                     no
  JPEG-2000                no
  JPEG                     no
  Little CMS               no
  Loadable Modules         no
  OpenMP                   no
  PNG                      no
  TIFF                     no
  TRIO                     no
  UMEM                     no
  WebP                     no
  WMF                      no
  X11                      no
  XML                      yes
  ZLIB                     yes

Host type: x86_64-apple-darwin16.7.0

Configured using the command:
  ./configure  'CC=clang' 'LDFLAGS=-L/usr/local/libjpeg/lib -L/usr/local/libpng/lib -L/usr/local/libtiff/lib' 'CPPFLAGS=-I/usr/local/libjpeg/include -I/usr/local/libpng/include -I/usr/local/libtiff/include' '--prefix=/usr/local/mac-dev-env/graphicsmagick-1.3.27'

Final Build Parameters:
  CC       = clang
  CFLAGS   = -g -O2 -Wall -D_THREAD_SAFE
  CPPFLAGS = -I/usr/local/libjpeg/include -I/usr/local/libpng/include -I/usr/local/libtiff/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2
  CXX      = g++
  CXXFLAGS = -D_THREAD_SAFE
  LDFLAGS  = -L/usr/local/libjpeg/lib -L/usr/local/libpng/lib -L/usr/local/libtiff/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib
  LIBS     = -lbz2 -lxml2 -lz -lm -lpthread

I am just not good with this terminal stuff quite yet, so I am mostly unsure how to interpret all these lines. I should have just used brew to install it in the first place D:

Any help would be appreciated!


Solution

  • Personally, I would recommend ImageMagick over GraphicsMagick, with reasons as in the comments above.

    To sort out your current situation, I would do the following:

    • ensure my PATH is correct for homebrew
    • uninstall all the mentioned packages
    • install the necessary packages
    • check my setup

    So, I'll cover each aspect of that with a separate section, and put a horizontal rule in between.


    Edit your login profile, probably $HOME/.profile and make sure that /usr/local/bin is at the start because that is where homebrew installs stuff. So basically, you want a line near the end like:

    export PATH=/usr/local/bin:$PATH
    

    Exit Terminal, and then start a new Terminal and check your PATH starts correctly with /usr/local/bin by running:

    echo $PATH
    

    Now remove all the packages you have been playing with:

    brew rm imagemagick jpeg libpng graphicsmagick
    

    Now reinstall just the ones you want:

    brew install jpeg libpng imagemagick 
    

    Now test that homebrew is happy, by running:

    brew doctor
    

    and following the good doctor's advice.

    Then you should be able to run:

    identify -version
    convert -size 1024x768 gradient:red-blue first.jpg
    

    You can see the created image by opening the Finder at the current directory:

    open .
    

    Then select the file with the mouse by tapping on it once, and press the SPACE bar to quick-look it.