diff --git a/README.md b/README.md index 6056e39c..0a11d9b2 100755 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ This module is powered by the blazingly fast [libvips](https://github.com/jcupit ### Prerequisites * Node.js v0.10+ -* [libvips](https://github.com/jcupitt/libvips) v7.38.5+ (7.40.12+ recommended) +* [libvips](https://github.com/jcupitt/libvips) v7.40.0+ (7.42.0+ recommended) To install the most suitable version of libvips on the following Operating Systems: @@ -214,12 +214,12 @@ sharp(inputBuffer) Constructor to which further methods are chained. `input`, if present, can be one of: -* Buffer containing JPEG, PNG, WebP or TIFF (libvips 7.40.0+) image data, or +* Buffer containing JPEG, PNG, WebP or TIFF image data, or * String containing the filename of an image, with most major formats supported. The object returned implements the [stream.Duplex](http://nodejs.org/api/stream.html#stream_class_stream_duplex) class. -JPEG, PNG, WebP or TIFF (libvips 7.40.0+) format image data can be streamed into the object when `input` is not provided. +JPEG, PNG, WebP or TIFF format image data can be streamed into the object when `input` is not provided. JPEG, PNG or WebP format image data can be streamed out from this object. @@ -232,7 +232,7 @@ Fast access to image metadata without decoding any compressed image data. * `format`: Name of decoder to be used to decompress image data e.g. `jpeg`, `png`, `webp` (for file-based input additionally `tiff` and `magick`) * `width`: Number of pixels wide * `height`: Number of pixels high -* `space`: Name of colour space interpretation e.g. `srgb`, `rgb`, `scrgb`, `cmyk`, `lab`, `xyz`, `b-w` [...](https://github.com/jcupitt/libvips/blob/master/libvips/iofuncs/enumtypes.c#L502) +* `space`: Name of colour space interpretation e.g. `srgb`, `rgb`, `scrgb`, `cmyk`, `lab`, `xyz`, `b-w` [...](https://github.com/jcupitt/libvips/blob/master/libvips/iofuncs/enumtypes.c#L522) * `channels`: Number of bands e.g. `3` for sRGB, `4` for CMYK * `hasAlpha`: Boolean indicating the presence of an alpha transparency channel * `orientation`: Number value of the EXIF Orientation header, if present diff --git a/index.js b/index.js index 29a9efbf..9f40367f 100755 --- a/index.js +++ b/index.js @@ -71,11 +71,9 @@ var Sharp = function(input) { (input[0] === 0x89 && input[1] === 0x50) || // WebP (input[0] === 0x52 && input[1] === 0x49) || - // TIFF - requires libvips 7.40.0+ - (semver.gte(libvipsVersion, '7.40.0') && ( - (input[0] === 0x4D && input[1] === 0x4D && input[2] === 0x00 && (input[3] === 0x2A || input[3] === 0x2B)) || - (input[0] === 0x49 && input[1] === 0x49 && (input[2] === 0x2A || input[2] === 0x2B) && input[3] === 0x00) - )) + // TIFF + (input[0] === 0x4D && input[1] === 0x4D && input[2] === 0x00 && (input[3] === 0x2A || input[3] === 0x2B)) || + (input[0] === 0x49 && input[1] === 0x49 && (input[2] === 0x2A || input[2] === 0x2B) && input[3] === 0x00) ) { this.options.bufferIn = input; } else { diff --git a/package.json b/package.json index 37e90936..cb57accc 100755 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "Brandon Aaron ", "Andreas Lind " ], - "description": "High performance Node.js module to resize JPEG, PNG and WebP images using the libvips library", + "description": "High performance Node.js module to resize JPEG, PNG, WebP and TIFF images using the libvips library", "scripts": { "test": "node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- --slow=5000 --timeout=10000 ./test/unit/*.js" }, @@ -36,8 +36,6 @@ "embed", "libvips", "vips", - "fast", - "buffer", "stream" ], "dependencies": { diff --git a/preinstall.sh b/preinstall.sh index 24f2fcf5..e051694d 100755 --- a/preinstall.sh +++ b/preinstall.sh @@ -5,13 +5,13 @@ # * Mac OS # * Debian Linux # * Debian 7, 8 -# * Ubuntu 12.04, 14.04, 14.10 +# * Ubuntu 12.04, 14.04, 14.10, 15.04 # * Mint 13, 17 # * Red Hat Linux # * RHEL/Centos/Scientific 6, 7 # * Fedora 21, 22 -vips_version_minimum=7.38.5 +vips_version_minimum=7.40.0 vips_version_latest_major=7.40 vips_version_latest_minor=11 diff --git a/src/common.cc b/src/common.cc index 79d10eea..9090718d 100755 --- a/src/common.cc +++ b/src/common.cc @@ -34,7 +34,6 @@ namespace sharp { unsigned char const MARKER_PNG[] = {0x89, 0x50}; unsigned char const MARKER_WEBP[] = {0x52, 0x49}; -#if (VIPS_MAJOR_VERSION >= 7 && VIPS_MINOR_VERSION >= 40) static bool buffer_is_tiff(char *buffer, size_t len) { return ( len >= 4 && ( @@ -43,7 +42,6 @@ namespace sharp { ) ); } -#endif /* Determine image format of a buffer. @@ -57,10 +55,8 @@ namespace sharp { imageType = ImageType::PNG; } else if (memcmp(MARKER_WEBP, buffer, 2) == 0) { imageType = ImageType::WEBP; -#if (VIPS_MAJOR_VERSION >= 7 && VIPS_MINOR_VERSION >= 40) } else if (buffer_is_tiff(static_cast(buffer), length)) { imageType = ImageType::TIFF; -#endif } } return imageType; @@ -77,10 +73,8 @@ namespace sharp { vips_pngload_buffer(buffer, length, &image, "access", access, NULL); } else if (imageType == ImageType::WEBP) { vips_webpload_buffer(buffer, length, &image, "access", access, NULL); -#if (VIPS_MAJOR_VERSION >= 7 && VIPS_MINOR_VERSION >= 40) } else if (imageType == ImageType::TIFF) { vips_tiffload_buffer(buffer, length, &image, "access", access, NULL); -#endif } return image; }