mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Add pageHeight and pages to anim output response #3411
This commit is contained in:
@@ -849,6 +849,11 @@ class PipelineWorker : public Napi::AsyncWorker {
|
||||
image = sharp::SetAnimationProperties(
|
||||
image, nPages, targetPageHeight, baton->delay, baton->loop);
|
||||
|
||||
if (image.get_typeof(VIPS_META_PAGE_HEIGHT) == G_TYPE_INT) {
|
||||
baton->pageHeightOut = image.get_int(VIPS_META_PAGE_HEIGHT);
|
||||
baton->pagesOut = image.get_int(VIPS_META_N_PAGES);
|
||||
}
|
||||
|
||||
// Output
|
||||
sharp::SetTimeout(image, baton->timeoutSeconds);
|
||||
if (baton->fileOut.empty()) {
|
||||
@@ -1284,6 +1289,10 @@ class PipelineWorker : public Napi::AsyncWorker {
|
||||
if (baton->input->textAutofitDpi) {
|
||||
info.Set("textAutofitDpi", static_cast<uint32_t>(baton->input->textAutofitDpi));
|
||||
}
|
||||
if (baton->pageHeightOut) {
|
||||
info.Set("pageHeight", static_cast<int32_t>(baton->pageHeightOut));
|
||||
info.Set("pages", static_cast<int32_t>(baton->pagesOut));
|
||||
}
|
||||
|
||||
if (baton->bufferOutLength > 0) {
|
||||
// Add buffer size to info
|
||||
|
||||
@@ -43,6 +43,8 @@ struct PipelineBaton {
|
||||
std::string fileOut;
|
||||
void *bufferOut;
|
||||
size_t bufferOutLength;
|
||||
int pageHeightOut;
|
||||
int pagesOut;
|
||||
std::vector<Composite *> composite;
|
||||
std::vector<sharp::InputDescriptor *> joinChannelIn;
|
||||
int topOffsetPre;
|
||||
@@ -226,6 +228,8 @@ struct PipelineBaton {
|
||||
PipelineBaton():
|
||||
input(nullptr),
|
||||
bufferOutLength(0),
|
||||
pageHeightOut(0),
|
||||
pagesOut(0),
|
||||
topOffsetPre(-1),
|
||||
topOffsetPost(-1),
|
||||
channels(0),
|
||||
|
||||
Reference in New Issue
Block a user