mirror of
https://github.com/lovell/sharp.git
synced 2025-07-10 02:50:15 +02:00
Changelog entry for #1595 (plus add GIF)
This commit is contained in:
parent
7cafd4386c
commit
1e4597c284
@ -12,6 +12,10 @@ Requires libvips v8.7.4.
|
|||||||
* Add `composite` operation supporting multiple images and blend modes; deprecate `overlayWith`.
|
* Add `composite` operation supporting multiple images and blend modes; deprecate `overlayWith`.
|
||||||
[#728](https://github.com/lovell/sharp/issues/728)
|
[#728](https://github.com/lovell/sharp/issues/728)
|
||||||
|
|
||||||
|
* Add support for `page` input option to GIF and PDF.
|
||||||
|
[#1595](https://github.com/lovell/sharp/pull/1595)
|
||||||
|
[@ramiel](https://github.com/ramiel)
|
||||||
|
|
||||||
### v0.21 - "*teeth*"
|
### v0.21 - "*teeth*"
|
||||||
|
|
||||||
Requires libvips v8.7.0.
|
Requires libvips v8.7.0.
|
||||||
|
@ -57,7 +57,7 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
|
|||||||
throw new Error('Expected width, height and channels for raw pixel input');
|
throw new Error('Expected width, height and channels for raw pixel input');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Page input for multi-page TIFF
|
// Page input for multi-page images (GIF, TIFF, PDF)
|
||||||
if (is.defined(inputOptions.page)) {
|
if (is.defined(inputOptions.page)) {
|
||||||
if (is.integer(inputOptions.page) && is.inRange(inputOptions.page, 0, 100000)) {
|
if (is.integer(inputOptions.page) && is.inRange(inputOptions.page, 0, 100000)) {
|
||||||
inputDescriptor.page = inputOptions.page;
|
inputDescriptor.page = inputOptions.page;
|
||||||
|
@ -212,6 +212,16 @@ namespace sharp {
|
|||||||
return imageType;
|
return imageType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Does this image type support multiple pages?
|
||||||
|
*/
|
||||||
|
bool ImageTypeSupportsPage(ImageType imageType) {
|
||||||
|
return
|
||||||
|
imageType == ImageType::GIF ||
|
||||||
|
imageType == ImageType::TIFF ||
|
||||||
|
imageType == ImageType::PDF;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Open an image from the given InputDescriptor (filesystem, compressed buffer, raw pixel data)
|
Open an image from the given InputDescriptor (filesystem, compressed buffer, raw pixel data)
|
||||||
*/
|
*/
|
||||||
@ -243,7 +253,7 @@ namespace sharp {
|
|||||||
if (imageType == ImageType::MAGICK) {
|
if (imageType == ImageType::MAGICK) {
|
||||||
option->set("density", std::to_string(descriptor->density).data());
|
option->set("density", std::to_string(descriptor->density).data());
|
||||||
}
|
}
|
||||||
if (imageType == ImageType::TIFF || imageType == ImageType::PDF) {
|
if (ImageTypeSupportsPage(imageType)) {
|
||||||
option->set("page", descriptor->page);
|
option->set("page", descriptor->page);
|
||||||
}
|
}
|
||||||
image = VImage::new_from_buffer(descriptor->buffer, descriptor->bufferLength, nullptr, option);
|
image = VImage::new_from_buffer(descriptor->buffer, descriptor->bufferLength, nullptr, option);
|
||||||
@ -288,7 +298,7 @@ namespace sharp {
|
|||||||
if (imageType == ImageType::MAGICK) {
|
if (imageType == ImageType::MAGICK) {
|
||||||
option->set("density", std::to_string(descriptor->density).data());
|
option->set("density", std::to_string(descriptor->density).data());
|
||||||
}
|
}
|
||||||
if (imageType == ImageType::TIFF || imageType == ImageType::PDF) {
|
if (ImageTypeSupportsPage(imageType)) {
|
||||||
option->set("page", descriptor->page);
|
option->set("page", descriptor->page);
|
||||||
}
|
}
|
||||||
image = VImage::new_from_file(descriptor->file.data(), option);
|
image = VImage::new_from_file(descriptor->file.data(), option);
|
||||||
|
@ -140,6 +140,11 @@ namespace sharp {
|
|||||||
*/
|
*/
|
||||||
ImageType DetermineImageType(char const *file);
|
ImageType DetermineImageType(char const *file);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Does this image type support multiple pages?
|
||||||
|
*/
|
||||||
|
bool ImageTypeSupportsPage(ImageType imageType);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Open an image from the given InputDescriptor (filesystem, compressed buffer, raw pixel data)
|
Open an image from the given InputDescriptor (filesystem, compressed buffer, raw pixel data)
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user