Simplify flag, fix togif crash, update license
This commit is contained in:
parent
3c16599126
commit
5ba0336837
4 changed files with 7 additions and 17 deletions
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2022 Essem
|
||||
Copyright (c) 2023 Essem
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#include <map>
|
||||
#include <string>
|
||||
#include <vips/vips8>
|
||||
|
||||
#include "common.h"
|
||||
|
@ -37,18 +35,8 @@ char *Flag(string *type, char *BufferData, size_t BufferLength,
|
|||
// this is a pretty cool line, just saying
|
||||
overlayImage = overlayImage * vector<double>{1, 1, 1, 0.5};
|
||||
}
|
||||
|
||||
vector<VImage> img;
|
||||
for (int i = 0; i < nPages; i++) {
|
||||
VImage img_frame =
|
||||
*type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in;
|
||||
VImage composited =
|
||||
img_frame.composite2(overlayImage, VIPS_BLEND_MODE_OVER);
|
||||
img.push_back(composited);
|
||||
}
|
||||
|
||||
VImage final = VImage::arrayjoin(img, VImage::option()->set("across", 1));
|
||||
final.set(VIPS_META_PAGE_HEIGHT, pageHeight);
|
||||
VImage replicated = overlayImage.replicate(1, nPages);
|
||||
VImage final = in.composite2(replicated, VIPS_BLEND_MODE_OVER);
|
||||
|
||||
void *buf;
|
||||
final.write_to_buffer(
|
||||
|
|
|
@ -9,7 +9,9 @@ char *ToGif(string *type, char *BufferData, size_t BufferLength,
|
|||
ArgumentMap Arguments, size_t *DataSize) {
|
||||
if (*type == "gif") {
|
||||
*DataSize = BufferLength;
|
||||
return BufferData;
|
||||
char *data = (char *)malloc(BufferLength);
|
||||
memcpy(data, BufferData, BufferLength);
|
||||
return data;
|
||||
} else {
|
||||
VOption *options = VImage::option()->set("access", "sequential");
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ export default function run(object) {
|
|||
// If no image type is given (say, the command generates its own image), make it a PNG.
|
||||
const fileExtension = object.params.type ? object.params.type.split("/")[1] : "png";
|
||||
promise.then(buf => {
|
||||
object.params.data = buf;
|
||||
if (buf) object.params.data = buf;
|
||||
const objectWithFixedType = Object.assign({}, object.params, { type: fileExtension });
|
||||
if (objectWithFixedType.gravity) {
|
||||
if (isNaN(objectWithFixedType.gravity)) {
|
||||
|
|
Loading…
Reference in a new issue