Fix uncaption

This commit is contained in:
Essem 2022-06-15 22:41:26 -05:00
parent 5106b3f21f
commit fbfc1bae85
No known key found for this signature in database
GPG Key ID: 7D497397CC3A2A8C
1 changed files with 7 additions and 2 deletions

View File

@ -35,13 +35,18 @@ Napi::Value Uncaption(const Napi::CallbackInfo &info) {
first.find_trim(&top, &captionWidth, &captionHeight);
vector<VImage> img;
int newHeight = page_height - top;
if (top == page_height) {
newHeight = page_height;
top = 0;
}
for (int i = 0; i < n_pages; i++) {
VImage img_frame =
in.crop(0, (i * page_height) + top, width, page_height - top);
in.crop(0, (i * page_height) + top, width, newHeight);
img.push_back(img_frame);
}
VImage final = VImage::arrayjoin(img, VImage::option()->set("across", 1));
final.set(VIPS_META_PAGE_HEIGHT, page_height - top);
final.set(VIPS_META_PAGE_HEIGHT, newHeight);
void *buf;
size_t length;