Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libvips/libimagequant/sharp/sharp-cli #183

Closed
3 tasks done
tmjoen opened this issue Aug 23, 2019 · 1 comment
Closed
3 tasks done

libvips/libimagequant/sharp/sharp-cli #183

tmjoen opened this issue Aug 23, 2019 · 1 comment

Comments

@tmjoen
Copy link
Contributor

tmjoen commented Aug 23, 2019

Update

for Mac M1s, we can now do

brew install vips
npm -g install https://github.com/brandocms/sharp-cli

The fork of sharp-cli prevents everything from getting converted to HEIF.

Older manual compile instructions

Create a recipe for the terraform that:

  • installs libimagequant
  • installs libvips with libimagequant
  • installs sharp-cli (hopefully picking up the new vips+imagequant)

https://github.com/jcupitt/libvips/wiki/Build-for-macOS

OSX

$ brew install vips
$ brew uninstall vips
$ brew install openexr openslide libmatio cfitsio libjpeg-turbo
$ brew remove imagemagick libheif

libheif screws up conversion on OSX -- everything gets turned into heif!!!

Add to ~/.zshrc

function addpkg() {
  export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$1/pkgconfig"
}

export PKG_CONFIG_PATH=
addpkg /usr/local/lib
addpkg /usr/local/opt/libxml2/lib
# we use xquartz: cairo needs those .pc as well
addpkg /opt/X11/lib
addpkg /usr/local/opt/libffi/lib
addpkg /Users/trond/vips/lib
export CPATH=`xcrun --show-sdk-path`/usr/include
$ brew install llvm
$ export PATH="/usr/local/opt/llvm/bin:$PATH"
$ brew install gawk wget
$ brew install autoconf automake gtk-doc swig gobject-introspection libimagequant
$ wget https://github.com/libvips/libvips/releases/download/v8.8.1/vips-8.8.1.tar.gz
$ tar xvf vips-8.8.3.tar.gz
$ cd vips-8.8.3
$ CFLAGS="-g -Wall" CXXFLAGS="-g -Wall" ./autogen.sh --without-magick --prefix=$HOME/vips --with-jpeg-includes=/usr/local/opt/jpeg-turbo/include --with-jpeg-libraries=/usr/local/opt/jpeg-turbo/lib
$ make
$ make install

$ pkg-config --modversion vips-cpp

@tmjoen
Copy link
Contributor Author

tmjoen commented Sep 10, 2019

libimagequant

wget https://github.com/ImageOptim/libimagequant/archive/2.12.5.tar.gz
tar xvf 2.12.5.tar.gz
cd libimagequant-2.12.5/
./configure --prefix=/usr
make libimagequant.so
sudo make install

libvips

sudo apt-get install git build-essential libxml2-dev libfftw3-dev libmagickwand-dev libopenexr-dev liborc-0.4-0 gobject-introspection libgsf-1-dev libglib2.0-dev liborc-0.4-dev
sudo apt-get install automake libtool swig gtk-doc-tools 
sudo apt-get libopenslide-dev libmatio-dev libgif-dev libwebp-dev
cd ~
git clone https://github.com/libvips/libvips.git
cd libvips
./autogen.sh --without-magick
make
sudo make install

Add to .bashrc / equivalent:

!!!!!MAYBE NOT NEEDED!!!!!

export VIPSHOME=/usr/local
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$VIPSHOME/lib
export PATH=$PATH:$VIPSHOME/bin
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$VIPSHOME/lib/pkgconfig
export MANPATH=$MANPATH:$VIPSHOME/man

sharp-cli

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install yarn
sudo yarn global add node-gyp
sudo yarn global add sharp-cli --verbose

@tmjoen tmjoen closed this as completed Sep 23, 2019
@tmjoen tmjoen pinned this issue Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant