mirror of
https://github.com/lovell/sharp.git
synced 2026-02-05 06:06:18 +01:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20e75dc50b | ||
|
|
d2e5441d6e | ||
|
|
0ffa1e72d0 | ||
|
|
a0e034a9e9 | ||
|
|
3c7cbf8685 | ||
|
|
7541dfcab2 | ||
|
|
dc2b79ac9a | ||
|
|
6d62051877 | ||
|
|
61b86744d7 | ||
|
|
fd5b4a131f | ||
|
|
32c4b9eff1 | ||
|
|
95cf35efc5 | ||
|
|
58e6368525 | ||
|
|
16e0d54b15 | ||
|
|
be381e4440 |
@@ -1,6 +1,7 @@
|
|||||||
build
|
build
|
||||||
node_modules
|
node_modules
|
||||||
coverage
|
coverage
|
||||||
|
.editorconfig
|
||||||
.jshintignore
|
.jshintignore
|
||||||
.jshintrc
|
.jshintrc
|
||||||
.gitignore
|
.gitignore
|
||||||
|
|||||||
@@ -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)']
|
||||||
}]
|
}]
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
36
binding.js
36
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,18 +69,31 @@ 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) {}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
request(distBaseUrl + tarFilename).on('response', function(response) {
|
var options = {
|
||||||
|
url: distBaseUrl + tarFilename
|
||||||
|
};
|
||||||
|
if (process.env.npm_config_https_proxy) {
|
||||||
|
// Use the NPM-configured HTTPS proxy
|
||||||
|
options.proxy = process.env.npm_config_https_proxy;
|
||||||
|
}
|
||||||
|
request(options).on('response', function(response) {
|
||||||
if (response.statusCode !== 200) {
|
if (response.statusCode !== 200) {
|
||||||
error(distBaseUrl + tarFilename + ' status code ' + response.statusCode);
|
error(distBaseUrl + tarFilename + ' status code ' + response.statusCode);
|
||||||
}
|
}
|
||||||
|
|||||||
38
docs/api.md
38
docs/api.md
@@ -426,8 +426,6 @@ Use WebP format for the output image.
|
|||||||
|
|
||||||
#### raw()
|
#### raw()
|
||||||
|
|
||||||
_Requires libvips 7.42.0+_
|
|
||||||
|
|
||||||
Provide raw, uncompressed uint8 (unsigned char) image data for Buffer and Stream based output.
|
Provide raw, uncompressed uint8 (unsigned char) image data for Buffer and Stream based output.
|
||||||
|
|
||||||
The number of channels depends on the input image and selected options.
|
The number of channels depends on the input image and selected options.
|
||||||
@@ -497,13 +495,11 @@ An advanced setting for the _zlib_ compression level of the lossless PNG output
|
|||||||
|
|
||||||
#### withoutAdaptiveFiltering()
|
#### withoutAdaptiveFiltering()
|
||||||
|
|
||||||
_Requires libvips 7.42.0+_
|
|
||||||
|
|
||||||
An advanced setting to disable adaptive row filtering for the lossless PNG output format.
|
An advanced setting to disable adaptive row filtering for the lossless PNG output format.
|
||||||
|
|
||||||
#### trellisQuantisation() / trellisQuantization()
|
#### trellisQuantisation() / trellisQuantization()
|
||||||
|
|
||||||
_Requires libvips 8.0.0+ compiled against mozjpeg 3.0+_
|
_Requires libvips to have been compiled with mozjpeg support_
|
||||||
|
|
||||||
An advanced setting to apply the use of
|
An advanced setting to apply the use of
|
||||||
[trellis quantisation](http://en.wikipedia.org/wiki/Trellis_quantization) with JPEG output.
|
[trellis quantisation](http://en.wikipedia.org/wiki/Trellis_quantization) with JPEG output.
|
||||||
@@ -511,7 +507,7 @@ Reduces file size and slightly increases relative quality at the cost of increas
|
|||||||
|
|
||||||
#### overshootDeringing()
|
#### overshootDeringing()
|
||||||
|
|
||||||
_Requires libvips 8.0.0+ compiled against mozjpeg 3.0+_
|
_Requires libvips to have been compiled with mozjpeg support_
|
||||||
|
|
||||||
An advanced setting to reduce the effects of
|
An advanced setting to reduce the effects of
|
||||||
[ringing](http://en.wikipedia.org/wiki/Ringing_%28signal%29) in JPEG output,
|
[ringing](http://en.wikipedia.org/wiki/Ringing_%28signal%29) in JPEG output,
|
||||||
@@ -519,7 +515,7 @@ in particular where black text appears on a white background (or vice versa).
|
|||||||
|
|
||||||
#### optimiseScans() / optimizeScans()
|
#### optimiseScans() / optimizeScans()
|
||||||
|
|
||||||
_Requires libvips 8.0.0+ compiled against mozjpeg 3.0+_
|
_Requires libvips to have been compiled with mozjpeg support_
|
||||||
|
|
||||||
An advanced setting for progressive (interlace) JPEG output.
|
An advanced setting for progressive (interlace) JPEG output.
|
||||||
Calculates which spectrum of DCT coefficients uses the fewest bits.
|
Calculates which spectrum of DCT coefficients uses the fewest bits.
|
||||||
@@ -633,3 +629,31 @@ Provides access to internal task counters.
|
|||||||
```javascript
|
```javascript
|
||||||
var counters = sharp.counters(); // { queue: 2, process: 4 }
|
var counters = sharp.counters(); // { queue: 2, process: 4 }
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### sharp.simd([enable])
|
||||||
|
|
||||||
|
_Requires libvips to have been compiled with liborc support_
|
||||||
|
|
||||||
|
Improves the performance of `resize`, `blur` and `sharpen` operations
|
||||||
|
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.
|
||||||
|
|
||||||
|
This method always returns the current state.
|
||||||
|
|
||||||
|
This feature is currently disabled by default
|
||||||
|
but future versions may enable it by default.
|
||||||
|
|
||||||
|
When enabled, versions of liborc prior to 0.4.24
|
||||||
|
and versions of libvips prior to 8.2.0
|
||||||
|
have been known to crash under heavy load.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var simd = sharp.simd();
|
||||||
|
// simd is `true` if SIMD is currently enabled
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var simd = sharp.simd(true);
|
||||||
|
// attempts to enable the use of SIMD, returning true if available
|
||||||
|
```
|
||||||
|
|||||||
@@ -2,7 +2,38 @@
|
|||||||
|
|
||||||
### v0.12 - "*look*"
|
### v0.12 - "*look*"
|
||||||
|
|
||||||
#### v0.12.0 - TBD
|
#### 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
|
||||||
|
|
||||||
|
* Allow use of SIMD vector instructions (via liborc) to be toggled on/off.
|
||||||
|
[#172](https://github.com/lovell/sharp/issues/172)
|
||||||
|
[@bkw](https://github.com/bkw)
|
||||||
|
[@puzrin](https://github.com/puzrin)
|
||||||
|
|
||||||
|
* Ensure embedded ICC profiles output with perceptual intent.
|
||||||
|
[#321](https://github.com/lovell/sharp/issues/321)
|
||||||
|
[@vlapo](https://github.com/vlapo)
|
||||||
|
|
||||||
|
* Use the NPM-configured HTTPS proxy, if any, for binary downloads.
|
||||||
|
|
||||||
|
#### v0.12.0 - 23<sup>rd</sup> November 2015
|
||||||
|
|
||||||
* Bundle pre-compiled libvips and its dependencies for 64-bit Linux and Windows.
|
* Bundle pre-compiled libvips and its dependencies for 64-bit Linux and Windows.
|
||||||
[#42](https://github.com/lovell/sharp/issues/42)
|
[#42](https://github.com/lovell/sharp/issues/42)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
12
index.js
12
index.js
@@ -863,3 +863,15 @@ module.exports.concurrency = function(concurrency) {
|
|||||||
module.exports.counters = function() {
|
module.exports.counters = function() {
|
||||||
return sharp.counters();
|
return sharp.counters();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Get and set use of SIMD vector unit instructions
|
||||||
|
*/
|
||||||
|
module.exports.simd = function(simd) {
|
||||||
|
if (typeof simd !== 'boolean') {
|
||||||
|
simd = null;
|
||||||
|
}
|
||||||
|
return sharp.simd(simd);
|
||||||
|
};
|
||||||
|
// Switch off default
|
||||||
|
module.exports.simd(false);
|
||||||
|
|||||||
20
package.json
20
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sharp",
|
"name": "sharp",
|
||||||
"version": "0.12.0",
|
"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.4",
|
"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
|
install_libvips_from_source "--prefix=/usr"
|
||||||
echo "Compiling vips with openslide support"
|
|
||||||
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
|
||||||
|
|||||||
@@ -421,7 +421,10 @@ class PipelineWorker : public AsyncWorker {
|
|||||||
if (HasProfile(image)) {
|
if (HasProfile(image)) {
|
||||||
// Convert to sRGB using embedded profile
|
// Convert to sRGB using embedded profile
|
||||||
VipsImage *transformed;
|
VipsImage *transformed;
|
||||||
if (!vips_icc_transform(image, &transformed, srgbProfile.data(), "embedded", TRUE, nullptr)) {
|
if (
|
||||||
|
!vips_icc_transform(image, &transformed, srgbProfile.data(),
|
||||||
|
"embedded", TRUE, "intent", VIPS_INTENT_PERCEPTUAL, nullptr)
|
||||||
|
) {
|
||||||
// Embedded profile can fail, so only update references on success
|
// Embedded profile can fail, so only update references on success
|
||||||
vips_object_local(hook, transformed);
|
vips_object_local(hook, transformed);
|
||||||
image = transformed;
|
image = transformed;
|
||||||
@@ -430,7 +433,10 @@ class PipelineWorker : public AsyncWorker {
|
|||||||
// Convert to sRGB using default "USWebCoatedSWOP" CMYK profile
|
// Convert to sRGB using default "USWebCoatedSWOP" CMYK profile
|
||||||
std::string cmykProfile = baton->iccProfilePath + "USWebCoatedSWOP.icc";
|
std::string cmykProfile = baton->iccProfilePath + "USWebCoatedSWOP.icc";
|
||||||
VipsImage *transformed;
|
VipsImage *transformed;
|
||||||
if (vips_icc_transform(image, &transformed, srgbProfile.data(), "input_profile", cmykProfile.data(), nullptr)) {
|
if (
|
||||||
|
vips_icc_transform(image, &transformed, srgbProfile.data(),
|
||||||
|
"input_profile", cmykProfile.data(), "intent", VIPS_INTENT_PERCEPTUAL, nullptr)
|
||||||
|
) {
|
||||||
return Error();
|
return Error();
|
||||||
}
|
}
|
||||||
vips_object_local(hook, transformed);
|
vips_object_local(hook, transformed);
|
||||||
@@ -621,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
|
||||||
@@ -655,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
|
||||||
|
|||||||
2
src/sharp.cc
Executable file → Normal file
2
src/sharp.cc
Executable file → Normal file
@@ -26,6 +26,8 @@ NAN_MODULE_INIT(init) {
|
|||||||
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(concurrency)).ToLocalChecked());
|
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(concurrency)).ToLocalChecked());
|
||||||
Nan::Set(target, Nan::New("counters").ToLocalChecked(),
|
Nan::Set(target, Nan::New("counters").ToLocalChecked(),
|
||||||
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(counters)).ToLocalChecked());
|
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(counters)).ToLocalChecked());
|
||||||
|
Nan::Set(target, Nan::New("simd").ToLocalChecked(),
|
||||||
|
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(simd)).ToLocalChecked());
|
||||||
Nan::Set(target, Nan::New("libvipsVersion").ToLocalChecked(),
|
Nan::Set(target, Nan::New("libvipsVersion").ToLocalChecked(),
|
||||||
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(libvipsVersion)).ToLocalChecked());
|
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(libvipsVersion)).ToLocalChecked());
|
||||||
Nan::Set(target, Nan::New("format").ToLocalChecked(),
|
Nan::Set(target, Nan::New("format").ToLocalChecked(),
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <node.h>
|
#include <node.h>
|
||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
|
#include <vips/vector.h>
|
||||||
|
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
|
|
||||||
@@ -81,6 +82,20 @@ NAN_METHOD(counters) {
|
|||||||
info.GetReturnValue().Set(counters);
|
info.GetReturnValue().Set(counters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Get and set use of SIMD vector unit instructions
|
||||||
|
*/
|
||||||
|
NAN_METHOD(simd) {
|
||||||
|
HandleScope();
|
||||||
|
|
||||||
|
// Set state
|
||||||
|
if (info[0]->IsBoolean()) {
|
||||||
|
vips_vector_set_enabled(To<bool>(info[0]).FromJust());
|
||||||
|
}
|
||||||
|
// Get state
|
||||||
|
info.GetReturnValue().Set(New<Boolean>(vips_vector_isenabled()));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get libvips version
|
Get libvips version
|
||||||
*/
|
*/
|
||||||
|
|||||||
1
src/utilities.h
Executable file → Normal file
1
src/utilities.h
Executable file → Normal file
@@ -6,6 +6,7 @@
|
|||||||
NAN_METHOD(cache);
|
NAN_METHOD(cache);
|
||||||
NAN_METHOD(concurrency);
|
NAN_METHOD(concurrency);
|
||||||
NAN_METHOD(counters);
|
NAN_METHOD(counters);
|
||||||
|
NAN_METHOD(simd);
|
||||||
NAN_METHOD(libvipsVersion);
|
NAN_METHOD(libvipsVersion);
|
||||||
NAN_METHOD(format);
|
NAN_METHOD(format);
|
||||||
NAN_METHOD(_maxColourDistance);
|
NAN_METHOD(_maxColourDistance);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
"gm": "^1.21.0",
|
"gm": "^1.21.0",
|
||||||
"imagemagick": "^0.1.3",
|
"imagemagick": "^0.1.3",
|
||||||
"imagemagick-native": "elad/node-imagemagick-native",
|
"imagemagick-native": "elad/node-imagemagick-native",
|
||||||
"jimp": "^0.2.19",
|
"jimp": "^0.2.20",
|
||||||
"lwip": "^0.0.8",
|
"lwip": "^0.0.8",
|
||||||
"semver": "^5.1.0"
|
"semver": "^5.1.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ var width = 720;
|
|||||||
var height = 480;
|
var height = 480;
|
||||||
|
|
||||||
sharp.concurrency(1);
|
sharp.concurrency(1);
|
||||||
|
sharp.simd(true);
|
||||||
|
|
||||||
var timer = setInterval(function() {
|
var timer = setInterval(function() {
|
||||||
console.dir(sharp.counters());
|
console.dir(sharp.counters());
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ var magickFilterBicubic = 'Lanczos';
|
|||||||
|
|
||||||
// Disable libvips cache to ensure tests are as fair as they can be
|
// Disable libvips cache to ensure tests are as fair as they can be
|
||||||
sharp.cache(0);
|
sharp.cache(0);
|
||||||
|
// Enable use of SIMD
|
||||||
|
sharp.simd(true);
|
||||||
|
|
||||||
async.series({
|
async.series({
|
||||||
'jpeg-linear': function(callback) {
|
'jpeg-linear': function(callback) {
|
||||||
@@ -496,6 +498,24 @@ async.series({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}).add('sharp-without-simd', {
|
||||||
|
defer: true,
|
||||||
|
fn: function(deferred) {
|
||||||
|
sharp.simd(false);
|
||||||
|
sharp(inputJpgBuffer)
|
||||||
|
.rotate(90)
|
||||||
|
.interpolateWith(sharp.interpolator.bilinear)
|
||||||
|
.resize(width, height)
|
||||||
|
.toBuffer(function(err, buffer) {
|
||||||
|
sharp.simd(true);
|
||||||
|
if (err) {
|
||||||
|
throw err;
|
||||||
|
} else {
|
||||||
|
assert.notStrictEqual(null, buffer);
|
||||||
|
deferred.resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}).add('sharp-sequentialRead', {
|
}).add('sharp-sequentialRead', {
|
||||||
defer: true,
|
defer: true,
|
||||||
fn: function(deferred) {
|
fn: function(deferred) {
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ var Benchmark = require('benchmark');
|
|||||||
var sharp = require('../../index');
|
var sharp = require('../../index');
|
||||||
var fixtures = require('../fixtures');
|
var fixtures = require('../fixtures');
|
||||||
|
|
||||||
|
sharp.simd(true);
|
||||||
|
|
||||||
var min = 320;
|
var min = 320;
|
||||||
var max = 960;
|
var max = 960;
|
||||||
|
|
||||||
|
|||||||
BIN
test/fixtures/expected/colourspace.cmyk-without-profile.jpg
vendored
Normal file
BIN
test/fixtures/expected/colourspace.cmyk-without-profile.jpg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
BIN
test/fixtures/expected/colourspace.cmyk.jpg
vendored
Normal file
BIN
test/fixtures/expected/colourspace.cmyk.jpg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
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 |
@@ -61,12 +61,12 @@ describe('Colour space conversion', function() {
|
|||||||
.resize(320, 240)
|
.resize(320, 240)
|
||||||
.background('white')
|
.background('white')
|
||||||
.embed()
|
.embed()
|
||||||
.toFile(fixtures.path('output.cmyk2srgb.jpg'), function(err, info) {
|
.toBuffer(function(err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
assert.strictEqual('jpeg', info.format);
|
assert.strictEqual('jpeg', info.format);
|
||||||
assert.strictEqual(320, info.width);
|
assert.strictEqual(320, info.width);
|
||||||
assert.strictEqual(240, info.height);
|
assert.strictEqual(240, info.height);
|
||||||
done();
|
fixtures.assertSimilar(fixtures.expected('colourspace.cmyk.jpg'), data, done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -75,10 +75,9 @@ describe('Colour space conversion', function() {
|
|||||||
.resize(320)
|
.resize(320)
|
||||||
.toBuffer(function(err, data, info) {
|
.toBuffer(function(err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
assert.strictEqual(true, data.length > 0);
|
|
||||||
assert.strictEqual('jpeg', info.format);
|
assert.strictEqual('jpeg', info.format);
|
||||||
assert.strictEqual(320, info.width);
|
assert.strictEqual(320, info.width);
|
||||||
done();
|
fixtures.assertSimilar(fixtures.expected('colourspace.cmyk-without-profile.jpg'), data, done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -51,6 +51,21 @@ describe('Utilities', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('SIMD', function() {
|
||||||
|
it('Can get current state', function() {
|
||||||
|
var simd = sharp.simd();
|
||||||
|
assert.strictEqual(typeof simd, 'boolean');
|
||||||
|
});
|
||||||
|
it('Can disable', function() {
|
||||||
|
var simd = sharp.simd(false);
|
||||||
|
assert.strictEqual(simd, false);
|
||||||
|
});
|
||||||
|
it('Can attempt to enable', function() {
|
||||||
|
var simd = sharp.simd(true);
|
||||||
|
assert.strictEqual(typeof simd, 'boolean');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('Format', function() {
|
describe('Format', function() {
|
||||||
it('Contains expected attributes', function() {
|
it('Contains expected attributes', function() {
|
||||||
assert.strictEqual('object', typeof sharp.format);
|
assert.strictEqual('object', typeof sharp.format);
|
||||||
|
|||||||
Reference in New Issue
Block a user