mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Changelog entry for #1595 (plus add GIF)
This commit is contained in:
@@ -212,6 +212,16 @@ namespace sharp {
|
||||
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)
|
||||
*/
|
||||
@@ -243,7 +253,7 @@ namespace sharp {
|
||||
if (imageType == ImageType::MAGICK) {
|
||||
option->set("density", std::to_string(descriptor->density).data());
|
||||
}
|
||||
if (imageType == ImageType::TIFF || imageType == ImageType::PDF) {
|
||||
if (ImageTypeSupportsPage(imageType)) {
|
||||
option->set("page", descriptor->page);
|
||||
}
|
||||
image = VImage::new_from_buffer(descriptor->buffer, descriptor->bufferLength, nullptr, option);
|
||||
@@ -288,7 +298,7 @@ namespace sharp {
|
||||
if (imageType == ImageType::MAGICK) {
|
||||
option->set("density", std::to_string(descriptor->density).data());
|
||||
}
|
||||
if (imageType == ImageType::TIFF || imageType == ImageType::PDF) {
|
||||
if (ImageTypeSupportsPage(imageType)) {
|
||||
option->set("page", descriptor->page);
|
||||
}
|
||||
image = VImage::new_from_file(descriptor->file.data(), option);
|
||||
|
||||
@@ -140,6 +140,11 @@ namespace sharp {
|
||||
*/
|
||||
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)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user