mirror of
https://github.com/lovell/sharp.git
synced 2026-02-08 07:36:16 +01:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20e75dc50b | ||
|
|
d2e5441d6e | ||
|
|
0ffa1e72d0 | ||
|
|
a0e034a9e9 | ||
|
|
3c7cbf8685 | ||
|
|
7541dfcab2 | ||
|
|
dc2b79ac9a | ||
|
|
6d62051877 | ||
|
|
61b86744d7 |
@@ -13,7 +13,7 @@ Bicubic interpolation with Lanczos anti-alias filtering ensures quality is not s
|
|||||||
As well as image resizing, operations such as
|
As well as image resizing, operations such as
|
||||||
rotation, extraction, compositing and gamma correction are available.
|
rotation, extraction, compositing and gamma correction are available.
|
||||||
|
|
||||||
64-bit Windows and recent Linux systems do not require
|
Most Windows (x64), Linux and ARMv6+ systems do not require
|
||||||
the installation of any external runtime dependencies.
|
the installation of any external runtime dependencies.
|
||||||
|
|
||||||
Use with OS X is as simple as running `brew install homebrew/science/vips`
|
Use with OS X is as simple as running `brew install homebrew/science/vips`
|
||||||
@@ -36,7 +36,7 @@ covers reporting bugs, requesting features and submitting code changes.
|
|||||||
|
|
||||||
### Licence
|
### Licence
|
||||||
|
|
||||||
Copyright 2013, 2014, 2015 Lovell Fuller and contributors.
|
Copyright 2013, 2014, 2015, 2016 Lovell Fuller and contributors.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -49,12 +49,12 @@
|
|||||||
'conditions': [
|
'conditions': [
|
||||||
['use_global_vips == "true"', {
|
['use_global_vips == "true"', {
|
||||||
# Use pkg-config for include and lib
|
# Use pkg-config for include and lib
|
||||||
'include_dirs': ['<!(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --cflags vips glib-2.0)'],
|
'include_dirs': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --cflags-only-I vips glib-2.0 | sed s\/-I//g)'],
|
||||||
'conditions': [
|
'conditions': [
|
||||||
['runtime_link == "static"', {
|
['runtime_link == "static"', {
|
||||||
'libraries': ['<!(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs vips --static)']
|
'libraries': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs --static vips)']
|
||||||
}, {
|
}, {
|
||||||
'libraries': ['<!(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs vips)']
|
'libraries': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs vips)']
|
||||||
}]
|
}]
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
27
binding.js
27
binding.js
@@ -25,7 +25,7 @@ var isFile = function(file) {
|
|||||||
return exists;
|
return exists;
|
||||||
};
|
};
|
||||||
|
|
||||||
var unpack = function(tarPath) {
|
var unpack = function(tarPath, done) {
|
||||||
var extractor = tar.Extract({
|
var extractor = tar.Extract({
|
||||||
path: __dirname
|
path: __dirname
|
||||||
});
|
});
|
||||||
@@ -34,6 +34,9 @@ var unpack = function(tarPath) {
|
|||||||
if (!isFile(vipsHeaderPath)) {
|
if (!isFile(vipsHeaderPath)) {
|
||||||
error('Could not unpack ' + tarPath);
|
error('Could not unpack ' + tarPath);
|
||||||
}
|
}
|
||||||
|
if (typeof done === 'function') {
|
||||||
|
done();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
fs.createReadStream(tarPath).on('error', error)
|
fs.createReadStream(tarPath).on('error', error)
|
||||||
.pipe(zlib.Unzip())
|
.pipe(zlib.Unzip())
|
||||||
@@ -54,9 +57,9 @@ var error = function(msg) {
|
|||||||
module.exports.download_vips = function() {
|
module.exports.download_vips = function() {
|
||||||
// Has vips been installed locally?
|
// Has vips been installed locally?
|
||||||
if (!isFile(vipsHeaderPath)) {
|
if (!isFile(vipsHeaderPath)) {
|
||||||
// Ensure 64-bit
|
// Ensure Intel 64-bit or ARM
|
||||||
if (process.arch !== 'x64') {
|
if (process.arch === 'ia32') {
|
||||||
error('ARM and 32-bit systems require manual installation - please see http://sharp.dimens.io/en/stable/install/');
|
error('Intel Architecture 32-bit systems require manual installation - please see http://sharp.dimens.io/en/stable/install/');
|
||||||
}
|
}
|
||||||
// Ensure libc >= 2.15
|
// Ensure libc >= 2.15
|
||||||
var lddVersion = process.env.LDD_VERSION;
|
var lddVersion = process.env.LDD_VERSION;
|
||||||
@@ -66,16 +69,22 @@ module.exports.download_vips = function() {
|
|||||||
error('libc version ' + libcVersion + ' requires manual installation - please see http://sharp.dimens.io/en/stable/install/');
|
error('libc version ' + libcVersion + ' requires manual installation - please see http://sharp.dimens.io/en/stable/install/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Platform-specific .tar.gz
|
// Arch/platform-specific .tar.gz
|
||||||
var tarFilename = ['libvips', process.env.npm_package_config_libvips, process.platform.substr(0, 3)].join('-') + '.tar.gz';
|
var platform = (process.arch === 'arm') ? 'arm' : process.platform.substr(0, 3);
|
||||||
|
var tarFilename = ['libvips', process.env.npm_package_config_libvips, platform].join('-') + '.tar.gz';
|
||||||
var tarPath = path.join(__dirname, 'packaging', tarFilename);
|
var tarPath = path.join(__dirname, 'packaging', tarFilename);
|
||||||
if (isFile(tarPath)) {
|
if (isFile(tarPath)) {
|
||||||
unpack(tarPath);
|
unpack(tarPath);
|
||||||
} else {
|
} else {
|
||||||
// Download
|
// Download to per-process temporary file
|
||||||
tarPath = path.join(tmp, tarFilename);
|
tarPath = path.join(tmp, process.pid + '-' + tarFilename);
|
||||||
var tmpFile = fs.createWriteStream(tarPath).on('finish', function() {
|
var tmpFile = fs.createWriteStream(tarPath).on('finish', function() {
|
||||||
unpack(tarPath);
|
unpack(tarPath, function() {
|
||||||
|
// Attempt to remove temporary file
|
||||||
|
try {
|
||||||
|
fs.unlinkSync(tarPath);
|
||||||
|
} catch (err) {}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
var options = {
|
var options = {
|
||||||
url: distBaseUrl + tarFilename
|
url: distBaseUrl + tarFilename
|
||||||
|
|||||||
@@ -635,7 +635,7 @@ var counters = sharp.counters(); // { queue: 2, process: 4 }
|
|||||||
_Requires libvips to have been compiled with liborc support_
|
_Requires libvips to have been compiled with liborc support_
|
||||||
|
|
||||||
Improves the performance of `resize`, `blur` and `sharpen` operations
|
Improves the performance of `resize`, `blur` and `sharpen` operations
|
||||||
by taking advantage of the SIMD vector unit of the CPU.
|
by taking advantage of the SIMD vector unit of the CPU, e.g. Intel SSE and ARM NEON.
|
||||||
|
|
||||||
* `enable`, if present, is a boolean where `true` enables and `false` disables the use of SIMD.
|
* `enable`, if present, is a boolean where `true` enables and `false` disables the use of SIMD.
|
||||||
|
|
||||||
@@ -650,7 +650,7 @@ have been known to crash under heavy load.
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var simd = sharp.simd();
|
var simd = sharp.simd();
|
||||||
// simd is `true` is SIMD is currently enabled
|
// simd is `true` if SIMD is currently enabled
|
||||||
```
|
```
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
|||||||
@@ -2,6 +2,24 @@
|
|||||||
|
|
||||||
### v0.12 - "*look*"
|
### v0.12 - "*look*"
|
||||||
|
|
||||||
|
#### v0.12.2 - 16<sup>th</sup> January 2016
|
||||||
|
|
||||||
|
* Upgrade libvips to v8.2.0 for improved vips_shrink.
|
||||||
|
|
||||||
|
* Add pre-compiled libvips for ARMv6+ CPUs.
|
||||||
|
|
||||||
|
* Ensure 16-bit input images work with embed option.
|
||||||
|
[#325](https://github.com/lovell/sharp/issues/325)
|
||||||
|
[@janaz](https://github.com/janaz)
|
||||||
|
|
||||||
|
* Allow compilation with gmake to provide FreeBSD support.
|
||||||
|
[#326](https://github.com/lovell/sharp/issues/326)
|
||||||
|
[@c0decafe](https://github.com/c0decafe)
|
||||||
|
|
||||||
|
* Attempt to remove temporary file after installation.
|
||||||
|
[#331](https://github.com/lovell/sharp/issues/331)
|
||||||
|
[@dtoubelis](https://github.com/dtoubelis)
|
||||||
|
|
||||||
#### v0.12.1 - 12<sup>th</sup> December 2015
|
#### v0.12.1 - 12<sup>th</sup> December 2015
|
||||||
|
|
||||||
* Allow use of SIMD vector instructions (via liborc) to be toggled on/off.
|
* Allow use of SIMD vector instructions (via liborc) to be toggled on/off.
|
||||||
|
|||||||
@@ -17,20 +17,21 @@ npm install sharp
|
|||||||
libvips and its dependencies are fetched and stored within `node_modules/sharp` during `npm install`.
|
libvips and its dependencies are fetched and stored within `node_modules/sharp` during `npm install`.
|
||||||
This involves an automated HTTPS download of approximately 6MB.
|
This involves an automated HTTPS download of approximately 6MB.
|
||||||
|
|
||||||
Most recent 64-bit Linux-based operating systems should "just work", e.g.:
|
Most recent Linux-based operating systems running on x64 and ARMv6+ CPUs should "just work", e.g.:
|
||||||
|
|
||||||
* Debian 7, 8
|
* Debian 7, 8
|
||||||
* Ubuntu 12.04, 14.04, 14.10, 15.04, 15.10
|
* Ubuntu 12.04, 14.04, 14.10, 15.04, 15.10
|
||||||
* Centos 7
|
* Centos 7
|
||||||
* Fedora 20, 21
|
* Fedora 21, 22, 23
|
||||||
* openSUSE 13.2
|
* openSUSE 13.2
|
||||||
* Archlinux 2015.06.01
|
* Archlinux 2015.06.01
|
||||||
|
* Raspbian Jessie
|
||||||
|
|
||||||
Preference will be given to an existing globally-installed (via `pkg-config`)
|
Preference will be given to an existing globally-installed (via `pkg-config`)
|
||||||
version of libvips that meets the minimum version requirement.
|
version of libvips that meets the minimum version requirement.
|
||||||
This allows the use of newer versions of libvips with older versions of sharp.
|
This allows the use of newer versions of libvips with older versions of sharp.
|
||||||
|
|
||||||
For older and 32-bit Linux-based operating systems,
|
For older Linux-based operating systems and 32-bit Intel CPUs,
|
||||||
a system-wide installation of the most suitable version of
|
a system-wide installation of the most suitable version of
|
||||||
libvips and its dependencies can be achieved by running
|
libvips and its dependencies can be achieved by running
|
||||||
the following command as a user with `sudo` access
|
the following command as a user with `sudo` access
|
||||||
@@ -77,6 +78,15 @@ This involves an automated HTTPS download of approximately 9MB.
|
|||||||
Only 64-bit (x64) `node.exe` is supported.
|
Only 64-bit (x64) `node.exe` is supported.
|
||||||
The WebP format is currently unavailable on Windows.
|
The WebP format is currently unavailable on Windows.
|
||||||
|
|
||||||
|
### FreeBSD
|
||||||
|
|
||||||
|
libvips must be installed before `npm install` is run.
|
||||||
|
This can be achieved via [FreshPorts](https://www.freshports.org/graphics/vips/):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd /usr/ports/graphics/vips/ && make install clean
|
||||||
|
```
|
||||||
|
|
||||||
### Heroku
|
### Heroku
|
||||||
|
|
||||||
[Alessandro Tagliapietra](https://github.com/alex88) maintains an
|
[Alessandro Tagliapietra](https://github.com/alex88) maintains an
|
||||||
|
|||||||
18
package.json
18
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sharp",
|
"name": "sharp",
|
||||||
"version": "0.12.1",
|
"version": "0.12.2",
|
||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Pierre Inglebert <pierre.inglebert@gmail.com>",
|
"Pierre Inglebert <pierre.inglebert@gmail.com>",
|
||||||
@@ -47,28 +47,28 @@
|
|||||||
"vips"
|
"vips"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bluebird": "^3.0.5",
|
"bluebird": "^3.1.1",
|
||||||
"color": "^0.10.1",
|
"color": "^0.11.1",
|
||||||
"nan": "^2.1.0",
|
"nan": "^2.2.0",
|
||||||
"semver": "^5.1.0",
|
"semver": "^5.1.0",
|
||||||
"request": "^2.67.0",
|
"request": "^2.67.0",
|
||||||
"tar": "^2.2.1"
|
"tar": "^2.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"async": "^1.5.0",
|
"async": "^1.5.2",
|
||||||
"coveralls": "^2.11.6",
|
"coveralls": "^2.11.6",
|
||||||
"exif-reader": "^1.0.0",
|
"exif-reader": "^1.0.0",
|
||||||
"icc": "^0.0.2",
|
"icc": "^0.0.2",
|
||||||
"istanbul": "^0.4.0",
|
"istanbul": "^0.4.2",
|
||||||
"mocha": "^2.3.4",
|
"mocha": "^2.3.4",
|
||||||
"mocha-jshint": "^2.2.5",
|
"mocha-jshint": "^2.2.6",
|
||||||
"node-cpplint": "^0.4.0",
|
"node-cpplint": "^0.4.0",
|
||||||
"rimraf": "^2.4.4",
|
"rimraf": "^2.5.0",
|
||||||
"bufferutil": "^1.2.1"
|
"bufferutil": "^1.2.1"
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"config": {
|
"config": {
|
||||||
"libvips": "8.1.1"
|
"libvips": "8.2.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10"
|
"node": ">=0.10"
|
||||||
|
|||||||
34
packaging/arm-build.sh
Executable file
34
packaging/arm-build.sh
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ $# -lt 1 ]; then
|
||||||
|
echo "Usage: $0 IP"
|
||||||
|
echo "Build libvips for ARM using Docker, where IP is"
|
||||||
|
echo "the address of a Raspberry Pi running HypriotOS"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
IP="$1"
|
||||||
|
|
||||||
|
echo "Verifying connectivity to $IP"
|
||||||
|
if ! ping -c 1 $IP; then
|
||||||
|
echo "Could not connect to $IP"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! type sshpass >/dev/null; then
|
||||||
|
echo "Please install sshpass"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
export SSHPASS=hypriot
|
||||||
|
|
||||||
|
echo "Copying arm/Dockerfile and arm/build.sh to device"
|
||||||
|
sshpass -e scp -o PreferredAuthentications=password -r arm root@${IP}:/root
|
||||||
|
|
||||||
|
echo "Building Raspbian-based container"
|
||||||
|
sshpass -e ssh -o PreferredAuthentications=password -t root@${IP} "docker build -t vips-dev-arm arm"
|
||||||
|
|
||||||
|
echo "Running arm/build.sh within container"
|
||||||
|
sshpass -e ssh -o PreferredAuthentications=password -t root@${IP} "docker run -i -t --rm -v \${PWD}/arm:/arm vips-dev-arm sh -c 'cd /arm && ./build.sh' | tee arm/build.log"
|
||||||
|
|
||||||
|
echo "Copying resultant tar.gz file from device"
|
||||||
|
sshpass -e scp -o PreferredAuthentications=password root@${IP}:/root/arm/*.tar.gz .
|
||||||
28
packaging/arm-test.sh
Executable file
28
packaging/arm-test.sh
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ $# -lt 1 ]; then
|
||||||
|
echo "Usage: $0 IP"
|
||||||
|
echo "Test sharp on ARM using Docker, where IP is"
|
||||||
|
echo "the address of a Raspberry Pi running HypriotOS"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
IP="$1"
|
||||||
|
|
||||||
|
echo "Verifying connectivity to $IP"
|
||||||
|
if ! ping -c 1 $IP; then
|
||||||
|
echo "Could not connect to $IP"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! type sshpass >/dev/null; then
|
||||||
|
echo "Please install sshpass"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
export SSHPASS=hypriot
|
||||||
|
|
||||||
|
echo "Copying sharp source to device"
|
||||||
|
sshpass -e scp -o PreferredAuthentications=password -r ../../sharp root@${IP}:/root/sharp
|
||||||
|
|
||||||
|
echo "Compile and test within container"
|
||||||
|
sshpass -e ssh -o PreferredAuthentications=password -t root@${IP} "docker run -i -t --rm -v \${PWD}/sharp:/s hypriot/rpi-node:5 sh -c 'cd /s && npm install --unsafe-perm && npm test'"
|
||||||
5
packaging/arm/Dockerfile
Normal file
5
packaging/arm/Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
FROM resin/rpi-raspbian:jessie
|
||||||
|
MAINTAINER Lovell Fuller <npm@lovell.info>
|
||||||
|
|
||||||
|
# Build dependencies
|
||||||
|
RUN apt-get update && apt-get install -y build-essential autoconf libtool nasm gtk-doc-tools texinfo curl
|
||||||
135
packaging/arm/build.sh
Executable file
135
packaging/arm/build.sh
Executable file
@@ -0,0 +1,135 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# To be run inside a Raspbian container
|
||||||
|
|
||||||
|
# Working directories
|
||||||
|
DEPS=/deps
|
||||||
|
TARGET=/target
|
||||||
|
mkdir ${DEPS}
|
||||||
|
mkdir ${TARGET}
|
||||||
|
|
||||||
|
# Common build paths and flags
|
||||||
|
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${TARGET}/lib/pkgconfig"
|
||||||
|
export PATH="${PATH}:${TARGET}/bin"
|
||||||
|
export CPPFLAGS="-I${TARGET}/include"
|
||||||
|
export LDFLAGS="-L${TARGET}/lib"
|
||||||
|
|
||||||
|
# Dependency version numbers
|
||||||
|
VERSION_ZLIB=1.2.8
|
||||||
|
VERSION_FFI=3.2.1
|
||||||
|
VERSION_GLIB=2.46.2
|
||||||
|
VERSION_XML2=2.9.3
|
||||||
|
VERSION_GSF=1.14.34
|
||||||
|
VERSION_EXIF=0.6.21
|
||||||
|
VERSION_JPEG=1.4.2
|
||||||
|
VERSION_PNG16=1.6.20
|
||||||
|
VERSION_LCMS2=2.7
|
||||||
|
VERSION_WEBP=0.5.0
|
||||||
|
VERSION_TIFF=4.0.6
|
||||||
|
VERSION_MAGICK=6.9.2-10
|
||||||
|
VERSION_ORC=0.4.24
|
||||||
|
VERSION_VIPS=8.2.0
|
||||||
|
|
||||||
|
mkdir ${DEPS}/zlib
|
||||||
|
curl -Ls http://zlib.net/zlib-${VERSION_ZLIB}.tar.xz | tar xJC ${DEPS}/zlib --strip-components=1
|
||||||
|
cd ${DEPS}/zlib
|
||||||
|
./configure --prefix=${TARGET} && make install
|
||||||
|
rm ${TARGET}/lib/libz.a
|
||||||
|
|
||||||
|
mkdir ${DEPS}/ffi
|
||||||
|
curl -Ls ftp://sourceware.org/pub/libffi/libffi-${VERSION_FFI}.tar.gz | tar xzC ${DEPS}/ffi --strip-components=1
|
||||||
|
cd ${DEPS}/ffi
|
||||||
|
./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking --disable-builddir && make install-strip
|
||||||
|
|
||||||
|
mkdir ${DEPS}/glib
|
||||||
|
curl -Ls http://ftp.gnome.org/pub/gnome/sources/glib/2.46/glib-${VERSION_GLIB}.tar.xz | tar xJC ${DEPS}/glib --strip-components=1
|
||||||
|
cd ${DEPS}/glib
|
||||||
|
./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
||||||
|
|
||||||
|
mkdir ${DEPS}/xml2
|
||||||
|
curl -Ls http://xmlsoft.org/sources/libxml2-${VERSION_XML2}.tar.gz | tar xzC ${DEPS}/xml2 --strip-components=1
|
||||||
|
cd ${DEPS}/xml2
|
||||||
|
./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking --without-python --with-zlib=${TARGET} && make install-strip
|
||||||
|
|
||||||
|
mkdir ${DEPS}/gsf
|
||||||
|
curl -Ls http://ftp.gnome.org/pub/GNOME/sources/libgsf/1.14/libgsf-${VERSION_GSF}.tar.xz | tar xJC ${DEPS}/gsf --strip-components=1
|
||||||
|
cd ${DEPS}/gsf
|
||||||
|
./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
||||||
|
|
||||||
|
mkdir ${DEPS}/exif
|
||||||
|
curl -Ls http://heanet.dl.sourceforge.net/project/libexif/libexif/${VERSION_EXIF}/libexif-${VERSION_EXIF}.tar.bz2 | tar xjC ${DEPS}/exif --strip-components=1
|
||||||
|
cd ${DEPS}/exif
|
||||||
|
./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
||||||
|
|
||||||
|
mkdir ${DEPS}/jpeg
|
||||||
|
curl -Ls http://heanet.dl.sourceforge.net/project/libjpeg-turbo/${VERSION_JPEG}/libjpeg-turbo-${VERSION_JPEG}.tar.gz | tar xzC ${DEPS}/jpeg --strip-components=1
|
||||||
|
cd ${DEPS}/jpeg
|
||||||
|
./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking --with-jpeg8 --without-turbojpeg && make install-strip
|
||||||
|
|
||||||
|
mkdir ${DEPS}/png16
|
||||||
|
curl -Ls http://heanet.dl.sourceforge.net/project/libpng/libpng16/${VERSION_PNG16}/libpng-${VERSION_PNG16}.tar.xz | tar xJC ${DEPS}/png16 --strip-components=1
|
||||||
|
cd ${DEPS}/png16
|
||||||
|
./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
||||||
|
|
||||||
|
mkdir ${DEPS}/lcms2
|
||||||
|
curl -Ls http://heanet.dl.sourceforge.net/project/lcms/lcms/${VERSION_LCMS2}/lcms2-${VERSION_LCMS2}.tar.gz | tar xzC ${DEPS}/lcms2 --strip-components=1
|
||||||
|
cd ${DEPS}/lcms2
|
||||||
|
./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
||||||
|
|
||||||
|
mkdir ${DEPS}/webp
|
||||||
|
curl -Ls http://downloads.webmproject.org/releases/webp/libwebp-${VERSION_WEBP}.tar.gz | tar xzC ${DEPS}/webp --strip-components=1
|
||||||
|
cd ${DEPS}/webp
|
||||||
|
./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
||||||
|
|
||||||
|
mkdir ${DEPS}/tiff
|
||||||
|
curl -Ls http://download.osgeo.org/libtiff/tiff-${VERSION_TIFF}.tar.gz /deps/tiff.tar.gz | tar xzC ${DEPS}/tiff --strip-components=1
|
||||||
|
cd ${DEPS}/tiff
|
||||||
|
./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
||||||
|
rm ${TARGET}/lib/libtiffxx*
|
||||||
|
|
||||||
|
mkdir ${DEPS}/magick
|
||||||
|
curl -Ls http://www.imagemagick.org/download/releases/ImageMagick-${VERSION_MAGICK}.tar.xz | tar xJC ${DEPS}/magick --strip-components=1
|
||||||
|
cd ${DEPS}/magick
|
||||||
|
./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking --without-magick-plus-plus && make install-strip
|
||||||
|
|
||||||
|
mkdir ${DEPS}/orc
|
||||||
|
curl -Ls http://gstreamer.freedesktop.org/data/src/orc/orc-${VERSION_ORC}.tar.xz | tar xJC ${DEPS}/orc --strip-components=1
|
||||||
|
cd ${DEPS}/orc
|
||||||
|
./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
||||||
|
|
||||||
|
mkdir ${DEPS}/vips
|
||||||
|
curl -Ls http://www.vips.ecs.soton.ac.uk/supported/8.2/vips-${VERSION_VIPS}.tar.gz | tar xzC ${DEPS}/vips --strip-components=1
|
||||||
|
cd ${DEPS}/vips
|
||||||
|
./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking \
|
||||||
|
--disable-debug --disable-introspection --without-python --without-fftw \
|
||||||
|
--with-zip-includes=${TARGET}/include --with-zip-libraries=${TARGET}/lib \
|
||||||
|
--with-jpeg-includes=${TARGET}/include --with-jpeg-libraries=${TARGET}/lib \
|
||||||
|
&& make install-strip
|
||||||
|
|
||||||
|
# Remove the C++ bindings
|
||||||
|
cd ${TARGET}/include
|
||||||
|
rm -rf vips/vipsc++.h vips/vipscpp.h vips/V*.h
|
||||||
|
cd ${TARGET}/lib
|
||||||
|
rm -rf pkgconfig .libs *.la libvipsCC* libvips-cpp.*
|
||||||
|
|
||||||
|
# Create JSON file of version numbers
|
||||||
|
cd ${TARGET}
|
||||||
|
echo "{\n\
|
||||||
|
\"zlib\": \"${VERSION_ZLIB}\",\n\
|
||||||
|
\"ffi\": \"${VERSION_FFI}\",\n\
|
||||||
|
\"glib\": \"${VERSION_GLIB}\",\n\
|
||||||
|
\"xml\": \"${VERSION_XML2}\",\n\
|
||||||
|
\"gsf\": \"${VERSION_GSF}\",\n\
|
||||||
|
\"exif\": \"${VERSION_EXIF}\",\n\
|
||||||
|
\"jpeg\": \"${VERSION_JPEG}\",\n\
|
||||||
|
\"png\": \"${VERSION_PNG16}\",\n\
|
||||||
|
\"lcms\": \"${VERSION_LCMS2}\",\n\
|
||||||
|
\"webp\": \"${VERSION_WEBP}\",\n\
|
||||||
|
\"tiff\": \"${VERSION_TIFF}\",\n\
|
||||||
|
\"magick\": \"${VERSION_MAGICK}\",\n\
|
||||||
|
\"orc\": \"${VERSION_ORC}\",\n\
|
||||||
|
\"vips\": \"${VERSION_VIPS}\"\n\
|
||||||
|
}" >lib/versions.json
|
||||||
|
|
||||||
|
# Create .tar.gz
|
||||||
|
GZIP=-9 tar czf /arm/libvips-${VERSION_VIPS}-arm.tar.gz include lib
|
||||||
@@ -13,14 +13,14 @@ fi
|
|||||||
|
|
||||||
docker build -t vips-dev-win win
|
docker build -t vips-dev-win win
|
||||||
WIN_CONTAINER_ID=$(docker run -d vips-dev-win)
|
WIN_CONTAINER_ID=$(docker run -d vips-dev-win)
|
||||||
docker cp $WIN_CONTAINER_ID:/libvips-8.1.1-win.tar.gz .
|
docker cp $WIN_CONTAINER_ID:/libvips-8.2.0-win.tar.gz .
|
||||||
docker rm $WIN_CONTAINER_ID
|
docker rm $WIN_CONTAINER_ID
|
||||||
|
|
||||||
# Linux
|
# Linux
|
||||||
|
|
||||||
docker build -t vips-dev-lin lin
|
docker build -t vips-dev-lin lin
|
||||||
LIN_CONTAINER_ID=$(docker run -d vips-dev-lin)
|
LIN_CONTAINER_ID=$(docker run -d vips-dev-lin)
|
||||||
docker cp $LIN_CONTAINER_ID:/libvips-8.1.1-lin.tar.gz .
|
docker cp $LIN_CONTAINER_ID:/libvips-8.2.0-lin.tar.gz .
|
||||||
docker rm $LIN_CONTAINER_ID
|
docker rm $LIN_CONTAINER_ID
|
||||||
|
|
||||||
# Checksums
|
# Checksums
|
||||||
|
|||||||
@@ -4,32 +4,32 @@ MAINTAINER Lovell Fuller <npm@lovell.info>
|
|||||||
# Build dependencies
|
# Build dependencies
|
||||||
RUN apt-get update && apt-get install -y build-essential autoconf libtool nasm gtk-doc-tools texinfo
|
RUN apt-get update && apt-get install -y build-essential autoconf libtool nasm gtk-doc-tools texinfo
|
||||||
|
|
||||||
# Working directories
|
# Create working directories
|
||||||
ENV DEPS /deps
|
ENV DEPS=/deps \
|
||||||
ENV TARGET /target
|
TARGET=/target
|
||||||
RUN mkdir ${DEPS} && mkdir ${TARGET}
|
RUN mkdir ${DEPS} && mkdir ${TARGET}
|
||||||
|
|
||||||
# Common build paths and flags
|
# Common build paths and flags
|
||||||
ENV PKG_CONFIG_PATH ${PKG_CONFIG_PATH}:${TARGET}/lib/pkgconfig
|
ENV PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${TARGET}/lib/pkgconfig \
|
||||||
ENV PATH ${PATH}:${TARGET}/bin
|
PATH=${PATH}:${TARGET}/bin \
|
||||||
ENV CPPFLAGS -I${TARGET}/include
|
CPPFLAGS=-I${TARGET}/include \
|
||||||
ENV LDFLAGS -L${TARGET}/lib
|
LDFLAGS=-L${TARGET}/lib
|
||||||
|
|
||||||
# Dependency version numbers
|
# Dependency version numbers
|
||||||
ENV VERSION_ZLIB 1.2.8
|
ENV VERSION_ZLIB=1.2.8 \
|
||||||
ENV VERSION_FFI 3.2.1
|
VERSION_FFI=3.2.1 \
|
||||||
ENV VERSION_GLIB 2.46.2
|
VERSION_GLIB=2.46.2 \
|
||||||
ENV VERSION_XML2 2.9.2
|
VERSION_XML2=2.9.3 \
|
||||||
ENV VERSION_GSF 1.14.34
|
VERSION_GSF=1.14.34 \
|
||||||
ENV VERSION_EXIF 0.6.21
|
VERSION_EXIF=0.6.21 \
|
||||||
ENV VERSION_JPEG 1.4.2
|
VERSION_JPEG=1.4.2 \
|
||||||
ENV VERSION_PNG16 1.6.19
|
VERSION_PNG16=1.6.20 \
|
||||||
ENV VERSION_LCMS2 2.7
|
VERSION_LCMS2=2.7 \
|
||||||
ENV VERSION_WEBP 0.4.4
|
VERSION_WEBP=0.5.0 \
|
||||||
ENV VERSION_TIFF 4.0.6
|
VERSION_TIFF=4.0.6 \
|
||||||
ENV VERSION_MAGICK 6.9.2-6
|
VERSION_MAGICK=6.9.2-10 \
|
||||||
ENV VERSION_ORC 0.4.24
|
VERSION_ORC=0.4.24 \
|
||||||
ENV VERSION_VIPS 8.1.1
|
VERSION_VIPS=8.2.0
|
||||||
|
|
||||||
RUN mkdir ${DEPS}/zlib
|
RUN mkdir ${DEPS}/zlib
|
||||||
RUN curl -Ls http://zlib.net/zlib-${VERSION_ZLIB}.tar.xz | tar xJC ${DEPS}/zlib --strip-components=1
|
RUN curl -Ls http://zlib.net/zlib-${VERSION_ZLIB}.tar.xz | tar xJC ${DEPS}/zlib --strip-components=1
|
||||||
@@ -58,22 +58,22 @@ WORKDIR ${DEPS}/gsf
|
|||||||
RUN ./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
RUN ./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
||||||
|
|
||||||
RUN mkdir ${DEPS}/exif
|
RUN mkdir ${DEPS}/exif
|
||||||
RUN curl -Ls http://kent.dl.sourceforge.net/project/libexif/libexif/${VERSION_EXIF}/libexif-${VERSION_EXIF}.tar.bz2 | tar xjC ${DEPS}/exif --strip-components=1
|
RUN curl -Ls http://heanet.dl.sourceforge.net/project/libexif/libexif/${VERSION_EXIF}/libexif-${VERSION_EXIF}.tar.bz2 | tar xjC ${DEPS}/exif --strip-components=1
|
||||||
WORKDIR ${DEPS}/exif
|
WORKDIR ${DEPS}/exif
|
||||||
RUN ./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
RUN ./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
||||||
|
|
||||||
RUN mkdir ${DEPS}/jpeg
|
RUN mkdir ${DEPS}/jpeg
|
||||||
RUN curl -Ls http://kent.dl.sourceforge.net/project/libjpeg-turbo/${VERSION_JPEG}/libjpeg-turbo-${VERSION_JPEG}.tar.gz | tar xzC ${DEPS}/jpeg --strip-components=1
|
RUN curl -Ls http://heanet.dl.sourceforge.net/project/libjpeg-turbo/${VERSION_JPEG}/libjpeg-turbo-${VERSION_JPEG}.tar.gz | tar xzC ${DEPS}/jpeg --strip-components=1
|
||||||
WORKDIR ${DEPS}/jpeg
|
WORKDIR ${DEPS}/jpeg
|
||||||
RUN ./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking --with-jpeg8 --without-turbojpeg && make install-strip
|
RUN ./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking --with-jpeg8 --without-turbojpeg && make install-strip
|
||||||
|
|
||||||
RUN mkdir ${DEPS}/png16
|
RUN mkdir ${DEPS}/png16
|
||||||
RUN curl -Ls http://kent.dl.sourceforge.net/project/libpng/libpng16/${VERSION_PNG16}/libpng-${VERSION_PNG16}.tar.xz | tar xJC ${DEPS}/png16 --strip-components=1
|
RUN curl -Ls http://heanet.dl.sourceforge.net/project/libpng/libpng16/${VERSION_PNG16}/libpng-${VERSION_PNG16}.tar.xz | tar xJC ${DEPS}/png16 --strip-components=1
|
||||||
WORKDIR ${DEPS}/png16
|
WORKDIR ${DEPS}/png16
|
||||||
RUN ./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
RUN ./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
||||||
|
|
||||||
RUN mkdir ${DEPS}/lcms2
|
RUN mkdir ${DEPS}/lcms2
|
||||||
RUN curl -Ls http://kent.dl.sourceforge.net/project/lcms/lcms/${VERSION_LCMS2}/lcms2-${VERSION_LCMS2}.tar.gz | tar xzC ${DEPS}/lcms2 --strip-components=1
|
RUN curl -Ls http://heanet.dl.sourceforge.net/project/lcms/lcms/${VERSION_LCMS2}/lcms2-${VERSION_LCMS2}.tar.gz | tar xzC ${DEPS}/lcms2 --strip-components=1
|
||||||
WORKDIR ${DEPS}/lcms2
|
WORKDIR ${DEPS}/lcms2
|
||||||
RUN ./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
RUN ./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ WORKDIR ${DEPS}/orc
|
|||||||
RUN ./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
RUN ./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking && make install-strip
|
||||||
|
|
||||||
RUN mkdir ${DEPS}/vips
|
RUN mkdir ${DEPS}/vips
|
||||||
RUN curl -Ls http://www.vips.ecs.soton.ac.uk/supported/8.1/vips-${VERSION_VIPS}.tar.gz | tar xzC ${DEPS}/vips --strip-components=1
|
RUN curl -Ls http://www.vips.ecs.soton.ac.uk/supported/8.2/vips-${VERSION_VIPS}.tar.gz | tar xzC ${DEPS}/vips --strip-components=1
|
||||||
WORKDIR ${DEPS}/vips
|
WORKDIR ${DEPS}/vips
|
||||||
RUN ./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking \
|
RUN ./configure --prefix=${TARGET} --enable-shared --disable-static --disable-dependency-tracking \
|
||||||
--disable-debug --disable-introspection --without-python --without-fftw \
|
--disable-debug --disable-introspection --without-python --without-fftw \
|
||||||
|
|||||||
@@ -6,11 +6,12 @@ RUN apt-get update && apt-get install -y curl zip
|
|||||||
# Fetch and unzip
|
# Fetch and unzip
|
||||||
RUN mkdir /vips
|
RUN mkdir /vips
|
||||||
WORKDIR /vips
|
WORKDIR /vips
|
||||||
RUN curl -O http://www.vips.ecs.soton.ac.uk/supported/8.1/win32/vips-dev-w64-8.1.1-3.zip
|
RUN curl -O http://www.vips.ecs.soton.ac.uk/supported/8.2/win32/vips-dev-w64-8.2.zip
|
||||||
RUN unzip vips-dev-w64-8.1.1-3.zip
|
RUN unzip vips-dev-w64-8.2.zip
|
||||||
|
|
||||||
# Clean and zip
|
# Clean and zip
|
||||||
WORKDIR /vips/vips-dev-8.1.1
|
WORKDIR /vips/vips-dev-8.2
|
||||||
RUN rm bin/libvipsCC-42.dll bin/libvips-cpp-42.dll bin/libgsf-win32-1-114.dll bin/libstdc++-6.dll
|
RUN rm bin/libvipsCC-42.dll bin/libvips-cpp-42.dll bin/libgsf-win32-1-114.dll bin/libstdc++-6.dll
|
||||||
RUN cp bin/*.dll lib/
|
RUN cp bin/*.dll lib/
|
||||||
RUN GZIP=-9 tar czf /libvips-8.1.1-win.tar.gz include lib/glib-2.0 lib/libvips.lib lib/libglib-2.0.lib lib/libgobject-2.0.lib lib/*.dll
|
RUN cp -r lib64/* lib/
|
||||||
|
RUN GZIP=-9 tar czf /libvips-8.2.0-win.tar.gz include lib/glib-2.0 lib/libvips.lib lib/libglib-2.0.lib lib/libgobject-2.0.lib lib/*.dll
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
# * Elementary 0.3
|
# * Elementary 0.3
|
||||||
# * Red Hat Linux
|
# * Red Hat Linux
|
||||||
# * RHEL/Centos/Scientific 6, 7
|
# * RHEL/Centos/Scientific 6, 7
|
||||||
# * Fedora 21, 22
|
# * Fedora 21, 22, 23
|
||||||
# * Amazon Linux 2015.03, 2015.09
|
# * Amazon Linux 2015.03, 2015.09
|
||||||
# * OpenSuse 13
|
# * OpenSuse 13
|
||||||
|
|
||||||
vips_version_minimum=7.40.0
|
vips_version_minimum=8.2.0
|
||||||
vips_version_latest_major_minor=8.1
|
vips_version_latest_major_minor=8.2
|
||||||
vips_version_latest_patch=1
|
vips_version_latest_patch=1
|
||||||
|
|
||||||
openslide_version_minimum=3.4.0
|
openslide_version_minimum=3.4.0
|
||||||
@@ -211,18 +211,8 @@ if [ -f /etc/debian_version ]; then
|
|||||||
DISTRO=$(lsb_release -c -s)
|
DISTRO=$(lsb_release -c -s)
|
||||||
echo "Detected Debian Linux '$DISTRO'"
|
echo "Detected Debian Linux '$DISTRO'"
|
||||||
case "$DISTRO" in
|
case "$DISTRO" in
|
||||||
jessie|vivid|wily)
|
jessie|trusty|utopic|vivid|wily|xenial|qiana|rebecca|rafaela|freya)
|
||||||
# Debian 8, Ubuntu 15
|
# Debian 8, Ubuntu 14.04+, Mint 17
|
||||||
if [ $enable_openslide -eq 1 ]; then
|
|
||||||
echo "Recompiling vips with openslide support"
|
|
||||||
install_libvips_from_source
|
|
||||||
else
|
|
||||||
echo "Installing libvips via apt-get"
|
|
||||||
apt-get install -y libvips-dev libgsf-1-dev
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
trusty|utopic|qiana|rebecca|rafaela|freya)
|
|
||||||
# Ubuntu 14, Mint 17
|
|
||||||
echo "Installing libvips dependencies via apt-get"
|
echo "Installing libvips dependencies via apt-get"
|
||||||
apt-get install -y automake build-essential gobject-introspection gtk-doc-tools libglib2.0-dev libjpeg-dev libpng12-dev libwebp-dev libtiff5-dev libexif-dev libgsf-1-dev liblcms2-dev libxml2-dev swig libmagickcore-dev curl
|
apt-get install -y automake build-essential gobject-introspection gtk-doc-tools libglib2.0-dev libjpeg-dev libpng12-dev libwebp-dev libtiff5-dev libexif-dev libgsf-1-dev liblcms2-dev libxml2-dev swig libmagickcore-dev curl
|
||||||
install_libvips_from_source
|
install_libvips_from_source
|
||||||
@@ -263,18 +253,12 @@ elif [ -f /etc/redhat-release ]; then
|
|||||||
yum install -y --enablerepo=remi libwebp-devel
|
yum install -y --enablerepo=remi libwebp-devel
|
||||||
install_libvips_from_source "--prefix=/usr"
|
install_libvips_from_source "--prefix=/usr"
|
||||||
;;
|
;;
|
||||||
"Fedora release 21 "*|"Fedora release 22 "*)
|
"Fedora"*)
|
||||||
# Fedora 21, 22
|
# Fedora 21, 22, 23
|
||||||
if [ $enable_openslide -eq 1 ]; then
|
|
||||||
echo "Installing libvips dependencies via yum"
|
echo "Installing libvips dependencies via yum"
|
||||||
yum groupinstall -y "Development Tools"
|
yum groupinstall -y "Development Tools"
|
||||||
yum install -y gcc-c++ gtk-doc libxml2-devel libjpeg-turbo-devel libpng-devel libtiff-devel libexif-devel lcms-devel ImageMagick-devel gobject-introspection-devel libwebp-devel curl
|
yum install -y gcc-c++ gtk-doc libxml2-devel libjpeg-turbo-devel libpng-devel libtiff-devel libexif-devel lcms-devel ImageMagick-devel gobject-introspection-devel libwebp-devel curl
|
||||||
echo "Compiling vips with openslide support"
|
|
||||||
install_libvips_from_source "--prefix=/usr"
|
install_libvips_from_source "--prefix=/usr"
|
||||||
else
|
|
||||||
echo "Installing libvips via yum"
|
|
||||||
yum install -y vips-devel
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# Unsupported RHEL-based OS
|
# Unsupported RHEL-based OS
|
||||||
|
|||||||
@@ -627,16 +627,6 @@ class PipelineWorker : public AsyncWorker {
|
|||||||
// Crop/embed
|
// Crop/embed
|
||||||
if (image->Xsize != baton->width || image->Ysize != baton->height) {
|
if (image->Xsize != baton->width || image->Ysize != baton->height) {
|
||||||
if (baton->canvas == Canvas::EMBED) {
|
if (baton->canvas == Canvas::EMBED) {
|
||||||
// Match background colour space, namely sRGB
|
|
||||||
if (image->Type != VIPS_INTERPRETATION_sRGB) {
|
|
||||||
// Convert to sRGB colour space
|
|
||||||
VipsImage *colourspaced;
|
|
||||||
if (vips_colourspace(image, &colourspaced, VIPS_INTERPRETATION_sRGB, nullptr)) {
|
|
||||||
return Error();
|
|
||||||
}
|
|
||||||
vips_object_local(hook, colourspaced);
|
|
||||||
image = colourspaced;
|
|
||||||
}
|
|
||||||
// Add non-transparent alpha channel, if required
|
// Add non-transparent alpha channel, if required
|
||||||
if (baton->background[3] < 255.0 && !HasAlpha(image)) {
|
if (baton->background[3] < 255.0 && !HasAlpha(image)) {
|
||||||
// Create single-channel transparency
|
// Create single-channel transparency
|
||||||
@@ -661,13 +651,22 @@ class PipelineWorker : public AsyncWorker {
|
|||||||
}
|
}
|
||||||
// Create background
|
// Create background
|
||||||
VipsArrayDouble *background;
|
VipsArrayDouble *background;
|
||||||
|
// Scale up 8-bit values to match 16-bit input image
|
||||||
|
double multiplier = (image->Type == VIPS_INTERPRETATION_RGB16) ? 256.0 : 1.0;
|
||||||
if (baton->background[3] < 255.0 || HasAlpha(image)) {
|
if (baton->background[3] < 255.0 || HasAlpha(image)) {
|
||||||
background = vips_array_double_newv(
|
// RGBA
|
||||||
4, baton->background[0], baton->background[1], baton->background[2], baton->background[3]
|
background = vips_array_double_newv(4,
|
||||||
|
baton->background[0] * multiplier,
|
||||||
|
baton->background[1] * multiplier,
|
||||||
|
baton->background[2] * multiplier,
|
||||||
|
baton->background[3] * multiplier
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
background = vips_array_double_newv(
|
// RGB
|
||||||
3, baton->background[0], baton->background[1], baton->background[2]
|
background = vips_array_double_newv(3,
|
||||||
|
baton->background[0] * multiplier,
|
||||||
|
baton->background[1] * multiplier,
|
||||||
|
baton->background[2] * multiplier
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Embed
|
// Embed
|
||||||
|
|||||||
BIN
test/fixtures/expected/embed-16bit.png
vendored
Normal file
BIN
test/fixtures/expected/embed-16bit.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 827 B |
@@ -68,6 +68,20 @@ describe('Embed', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('16-bit PNG with alpha channel', function(done) {
|
||||||
|
sharp(fixtures.inputPngWithTransparency16bit)
|
||||||
|
.resize(32, 16)
|
||||||
|
.embed()
|
||||||
|
.toBuffer(function(err, data, info) {
|
||||||
|
if (err) throw err;
|
||||||
|
assert.strictEqual(true, data.length > 0);
|
||||||
|
assert.strictEqual('png', info.format);
|
||||||
|
assert.strictEqual(32, info.width);
|
||||||
|
assert.strictEqual(16, info.height);
|
||||||
|
fixtures.assertSimilar(fixtures.expected('embed-16bit.png'), data, done);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('Enlarge and embed', function(done) {
|
it('Enlarge and embed', function(done) {
|
||||||
sharp(fixtures.inputPngWithOneColor)
|
sharp(fixtures.inputPngWithOneColor)
|
||||||
.embed()
|
.embed()
|
||||||
|
|||||||
Reference in New Issue
Block a user