Compare commits

...

12 Commits

Author SHA1 Message Date
Lovell Fuller
75d72cfded Version bumps ahead of v0.10.1 2015-06-01 09:50:49 +01:00
Lovell Fuller
21b0d8c7f7 Version bumps ahead of v0.10.1
Use SPDX format in licence field
2015-05-31 19:35:24 +01:00
Lovell Fuller
fa8f06f07d Include C standard library for 'atoi' #228
Xcode 6.3 appears to no longer do this
2015-05-31 19:05:18 +01:00
Lovell Fuller
e07a105b7c Test availability of __has_feature macro 2015-05-11 11:54:53 +01:00
Lovell Fuller
4f72dcbf54 Verify platform/compiler compatibility #178 #214 2015-05-11 10:46:47 +01:00
Lovell Fuller
b77877c83d Add Amazon Linux 2015.03
Update to libvips version 8.0.2
2015-05-07 15:50:14 +01:00
Lovell Fuller
8fd3520257 Correct use of Windows CI env variable 2015-05-05 11:15:32 +01:00
Lovell Fuller
f15e64039c Windows CI does not yet have io.js v2 2015-05-05 10:46:23 +01:00
Lovell Fuller
3ffe2ba17f Windows CI matrix and version bumps 2015-05-05 10:15:20 +01:00
Lovell Fuller
33782d3c83 Embed alpha image on non-transparent background #204 2015-04-29 20:14:45 +01:00
Lovell Fuller
783826aa26 Reverse Openslide if/else for Debian 8 #203 2015-04-27 18:44:53 +01:00
Lovell Fuller
c2ef16eac2 Don't publish AppVeyor config to npm 2015-04-27 18:44:11 +01:00
9 changed files with 74 additions and 30 deletions

View File

@@ -6,3 +6,4 @@ coverage
.gitignore
test
.travis.yml
appveyor.yml

View File

@@ -2,7 +2,8 @@ language: node_js
node_js:
- "0.10"
- "0.12"
- iojs
- "iojs-v1"
- "iojs-v2"
before_install:
- curl -s https://raw.githubusercontent.com/lovell/sharp/master/preinstall.sh | sudo bash -
after_success:

View File

@@ -2,9 +2,16 @@ os: Visual Studio 2014 CTP4
platform: Win32
configuration: Release
environment:
VIPS_VERSION_MAJOR_MINOR: 7.42
VIPS_VERSION_PATCH: 3
VIPS_VERSION_MAJOR_MINOR: 8.0
VIPS_VERSION_PATCH: 2
VIPS_WARNING: 0
matrix:
- nodejs_version: "0.10"
nodejs_exec: "node"
- nodejs_version: "0.12"
nodejs_exec: "node"
- nodejs_version: "1.0"
nodejs_exec: "iojs"
install:
- ps: $env:VIPS_VERSION = "$env:VIPS_VERSION_MAJOR_MINOR.$env:VIPS_VERSION_PATCH"
- ps: Write-Output "Fetching http://www.vips.ecs.soton.ac.uk/supported/$env:VIPS_VERSION_MAJOR_MINOR/win32/vips-dev-$env:VIPS_VERSION.zip"
@@ -12,7 +19,7 @@ install:
- ps: Invoke-Expression "& 7z -y x c:\vips-dev-$env:VIPS_VERSION.zip -oc:\ | FIND /V `"ing `""
- ps: $env:VIPS_HOME = "c:\vips-dev-$env:VIPS_VERSION"
- ps: $env:PATH = "$env:VIPS_HOME\bin;$env:PATH"
- ps: Install-Product node 0 x86
- ps: Install-Product node $env:nodejs_version x86
- npm install --arch=ia32 --msvs_version=2013
test_script:
- npm run-script test-win32-node
- npm run-script test-win32-%nodejs_exec%

View File

@@ -1,6 +1,6 @@
{
"name": "sharp",
"version": "0.10.0",
"version": "0.10.1",
"author": "Lovell Fuller <npm@lovell.info>",
"contributors": [
"Pierre Inglebert <pierre.inglebert@gmail.com>",
@@ -20,9 +20,9 @@
],
"description": "High performance Node.js module to resize JPEG, PNG, WebP and TIFF images using the libvips library",
"scripts": {
"test": "VIPS_WARNING=0 node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- --slow=5000 --timeout=15000 ./test/unit/*.js",
"test-win32-node": "node ./node_modules/mocha/bin/mocha --slow=5000 --timeout=15000 ./test/unit/*.js",
"test-win32-iojs": "iojs ./node_modules/mocha/bin/mocha --slow=5000 --timeout=15000 ./test/unit/*.js"
"test": "VIPS_WARNING=0 node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- --slow=5000 --timeout=20000 ./test/unit/*.js",
"test-win32-node": "node ./node_modules/mocha/bin/mocha --slow=5000 --timeout=20000 ./test/unit/*.js",
"test-win32-iojs": "iojs ./node_modules/mocha/bin/mocha --slow=5000 --timeout=20000 ./test/unit/*.js"
},
"main": "index.js",
"repository": {
@@ -42,21 +42,21 @@
"vips"
],
"dependencies": {
"bluebird": "^2.9.24",
"bluebird": "^2.9.27",
"color": "^0.8.0",
"nan": "^1.7.0",
"semver": "^4.3.3"
"nan": "^1.8.4",
"semver": "^4.3.6"
},
"devDependencies": {
"mocha": "^2.2.4",
"mocha-jshint": "^2.2.0",
"istanbul": "^0.3.13",
"async": "^1.1.0",
"coveralls": "^2.11.2",
"istanbul": "^0.3.14",
"mocha": "^2.2.5",
"mocha-jshint": "^2.2.3",
"node-cpplint": "^0.4.0",
"rimraf": "^2.3.2",
"async": "^0.9.0"
"rimraf": "^2.3.4"
},
"license": "Apache 2.0",
"license": "Apache-2.0",
"engines": {
"node": ">=0.10"
}

View File

@@ -13,12 +13,12 @@
# * Amazon Linux 2014.09
vips_version_minimum=7.40.0
vips_version_latest_major_minor=7.42
vips_version_latest_patch=3
vips_version_latest_major_minor=8.0
vips_version_latest_patch=2
openslide_version_minimum=3.4.0
openslide_version_latest_major_minor=3.4
openslide_version_latest_patch=0
openslide_version_latest_patch=1
install_libvips_from_source() {
echo "Compiling libvips $vips_version_latest_major_minor.$vips_version_latest_patch from source"
@@ -250,11 +250,11 @@ case $(uname -s) in
jessie|vivid)
# Debian 8, Ubuntu 15
if [ $enable_openslide -eq 1 ]; then
echo "Installing libvips via apt-get"
apt-get install -y libvips-dev libgsf-1-dev
else
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)
@@ -321,7 +321,7 @@ case $(uname -s) in
# Probably Amazon Linux
RELEASE=$(cat /etc/system-release)
case $RELEASE in
"Amazon Linux AMI release 2014.09")
"Amazon Linux AMI release 2014.09"|"Amazon Linux AMI release 2015.03")
# Amazon Linux
echo "Detected '$RELEASE'"
echo "Installing libvips dependencies via yum"
@@ -329,6 +329,10 @@ case $(uname -s) in
yum install -y gtk-doc libxml2-devel libjpeg-turbo-devel libpng-devel libtiff-devel libexif-devel libgsf-devel lcms-devel ImageMagick-devel gobject-introspection-devel libwebp-devel curl
install_libvips_from_source "--prefix=/usr"
;;
*)
# Unsupported Amazon Linux version
sorry "vips" "$RELEASE"
;;
esac
elif [ -f /etc/os-release ]; then
RELEASE=$(cat /etc/os-release | grep VERSION)

View File

@@ -1,9 +1,26 @@
#include <cstdlib>
#include <string>
#include <string.h>
#include <vips/vips.h>
#include "common.h"
// Verify platform and compiler compatibility
#ifdef _WIN64
#error Windows 64-bit is currently unsupported - see https://github.com/lovell/sharp#windows
#endif
#if ((!defined(__clang__)) && defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)))
#error GCC version 4.6+ is required for C++11 features - see https://github.com/lovell/sharp#prerequisites
#endif
#if (defined(__clang__) && defined(__has_feature))
#if (!__has_feature(cxx_range_for))
#error clang version 3.0+ is required for C++11 features - see https://github.com/lovell/sharp#prerequisites
#endif
#endif
namespace sharp {
// How many tasks are in the queue?

View File

@@ -593,7 +593,7 @@ class ResizeWorker : public NanAsyncWorker {
}
// Create background
VipsArrayDouble *background;
if (baton->background[3] < 255.0) {
if (baton->background[3] < 255.0 || HasAlpha(image)) {
background = vips_array_double_newv(
4, baton->background[0], baton->background[1], baton->background[2], baton->background[3]
);

View File

@@ -8,10 +8,6 @@
#include "resize.h"
#include "utilities.h"
#ifdef _WIN64
#error Windows 64-bit currently unsupported - see https://github.com/lovell/sharp#windows
#endif
extern "C" void init(v8::Handle<v8::Object> target) {
NanScope();
vips_init("sharp");

View File

@@ -50,4 +50,22 @@ describe('Embed', function() {
});
}
it('PNG with alpha channel', function(done) {
sharp(fixtures.inputPngWithTransparency)
.resize(50, 50)
.embed()
.toBuffer(function(err, data, info) {
if (err) throw err;
assert.strictEqual(true, data.length > 0);
assert.strictEqual('png', info.format);
assert.strictEqual(50, info.width);
assert.strictEqual(50, info.height);
sharp(data).metadata(function(err, metadata) {
if (err) throw err;
assert.strictEqual(4, metadata.channels);
done();
});
});
});
});