1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-11-24 08:12:38 +02:00

Ensure that the watermark is always centered when replicated

This commit is contained in:
DarthSim 2024-04-24 21:18:55 +03:00
parent df75177481
commit aeb2c087d4
2 changed files with 15 additions and 2 deletions

View File

@ -7,6 +7,7 @@
### Change
- Respond with 404 when the bucket/container name or object key is empty in an S3, Google Cloud Storage, Azure Blob Storage, or OpenStack Object Storage (Swift) URL.
- Ensure that the watermark is always centered when replicated.
- (pro) Improve unsharp masking.
- (docker) Update AWS Lambda adapter to 0.8.2.
- (docker) Increase EXIF size limit to 8MB.

View File

@ -695,10 +695,22 @@ vips_replicate_go(VipsImage *in, VipsImage **out, int width, int height)
{
VipsImage *tmp;
if (vips_replicate(in, &tmp, 1 + width / in->Xsize, 1 + height / in->Ysize, NULL))
int across = VIPS_CEIL((double) width / in->Xsize);
int down = VIPS_CEIL((double) height / in->Ysize);
if (across % 2 == 0)
across++;
if (down % 2 == 0)
down++;
if (vips_replicate(in, &tmp, across, down, NULL))
return 1;
if (vips_extract_area(tmp, out, 0, 0, width, height, NULL)) {
if (vips_extract_area(tmp, out,
(tmp->Xsize - width) / 2,
(tmp->Ysize - height) / 2,
width, height,
NULL)) {
clear_image(&tmp);
return 1;
}