I have had a look around Google to see if I can find a static build of GraphicsMagick with all possible filetype support and (ideally) dcraw
built in.
Ideally, it would be fully self contained and essentially portable.
I am only really bothered about macOS and Windows (the GraphicsMagick site suggests that the Windows build is already built like that -- though I am unsure about dcraw
).
I am a web developer who wants to use this in an Electron app, so I am not sure of the correct terminology , so please forgive any inaccuracies in the ramblings above.
For mac I use following script to create a static version with png, jpg and webp included:
# download sources
curl -L http://ftp.icm.edu.pl/pub/unix/graphics/GraphicsMagick/1.3/GraphicsMagick-1.3.31.tar.gz | tar xvz
# zlib needed for png
curl -L http://ftp.icm.edu.pl/pub/unix/graphics/GraphicsMagick/delegates/zlib-1.2.11.tar.gz | tar xvz
curl -L http://ftp.icm.edu.pl/pub/unix/graphics/GraphicsMagick/delegates/libpng-1.6.28.tar.gz | tar xvz
curl -L http://ftp.icm.edu.pl/pub/unix/graphics/GraphicsMagick/delegates/libwebp-1.0.0.tar.gz | tar xvz
curl -L http://ftp.icm.edu.pl/pub/unix/graphics/GraphicsMagick/delegates/jpegsrc.v6b2.tar.gz | tar xvz
export mydir=$(pwd)
export CPPFLAGS="-I$mydir/include"
export LDFLAGS="-L$mydir/lib"
# use `less zlib-<TAB>/configure` to discover configure options
(cd zlib-* && ./configure --static --prefix=$mydir && make install)
(cd libpng-* && ./configure --disable-shared --prefix=$mydir && make install)
(cd libwebp-* && ./configure --disable-shared --enable-libwebpmux --prefix=$mydir && make install)
(cd jpeg-* && ./configure --disable-shared --prefix=$mydir && make install)
(cd GraphicsMagick-* && ./configure --disable-installed --prefix=$mydir && make install)
./bin/gm version
ldd ./bin/gm
# test
mkdir test && cd test
cp ../jpeg-6b2/testimg.bmp ./test.bmp
../bin/gm convert test.bmp jpg.jpg
../bin/gm convert jpg.jpg jpg.bmp
../bin/gm convert test.bmp png.png
../bin/gm convert png.png png.bmp
../bin/gm convert test.bmp webp.webp
../bin/gm convert webp.webp webp.bmp
You could use that as a start for including further libraries if needed. My use case was also to include it in electron. After trying to crosscompile a static Windows version I came to the conclusion that for the Windows version it would be less maintenance-cost to use the officially provided precompiled multi-file version.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.