When one adds a watermark to a series of images using the Batch Processing engine (why we cannot use this engine in the Viewer on the currently opened file?) the watermark gets distorted (stretched) when one uses the Percentage option of the watermark to scale to the dimensions of the image.
If one wants to put a circle as watermark and sets the program to have the circle to be 10% from the image's width, unfortunately the program scales the watermark 10% from the image's width and 10% from the image's height. And because usually the images have different proportion ratios (3:2, 4:3) than the watermarks, these get distorted. See in the picture bellow the red circle which became an ellipse:
My proposal:
Add a checkbox next to the Percentage option, which should be checked by default, saying 'Keep proportion ratio'. When checked, the watermark will keep the proportions based only on the image's width (like the caption already says)
Watermark is stretched when is applied in Batch Processing
Moderators: XnTriq, helmut, xnview
-
- XnThusiast
- Posts: 1676
- Joined: Wed Aug 16, 2006 6:31 am
Watermark is stretched when is applied in Batch Processing
You do not have the required permissions to view the files attached to this post.
m. Th.
- Dark Themed XnViewMP 1.7.1 64bit on Win11 x64 -
- Dark Themed XnViewMP 1.7.1 64bit on Win11 x64 -
-
- Posts: 8705
- Joined: Sun Oct 12, 2003 6:47 pm
- Location: Frankfurt, Germany
Re: Watermark is stretched when is applied in Batch Processi
A good idea to use a circle as watermark, m.Th.m.Th. wrote:...
My proposal:
Add a checkbox next to the Percentage option, which should be checked by default, saying 'Keep proportion ratio'. When checked, the watermark will keep the proportions based only on the image's width (like the caption already says)

How to interpret the percentage value
Though, how should a 10 % value be interpreted? 10% height of the image? 10% width of the image? Longer side of height and width?
I think the following approach will work: Calculate the zoom factors for width and height for the watermark image and then use the smaller of the two zoom factors.
Watermark image has width_water x height_water pixels.
Image to be watermarked has width_image x height_image pixels.
The width and height of the image that the watermark can cover:
Width_for_watermark = width_image * percentage / 100
Height_for_watermark = height_image * percentage / 100
Calculate zoom factors for the watermark to fit in the
Zoom_Water_X = width_for_water / width_water * 100
Zoom_Water_Y = height_for_water / height_water * 100
The zoom factor for the watermark is the smaller of the two calculated zoom factors:
Zoom_Water = Min(Zoom_Water_X, Zoom_Water_Y)
Example:
Watermark image has 100 x 150 pixels
Image to be watermarked has 3000 x 2000 pixels
Watermark should cover 10 % (of width or height)
Width_for_watermark = 3000px * 10 / 100 = 300px
Height_for_watermark = 2000px * 10 / 100 = 200px
Zoom_Water_X = 300px / 100px * 100 = 300 %
Zoom_Water_Y = 200px / 150px * 100 = 133 %
Zoom_Water = Min(300%, 133%) = 133%
--> Watermark will be zoomed with 133% and have 133 x 200 pixels in the image. This is 4,4% of the width and 10% of the height of the image.
-
- Author of XnView
- Posts: 45495
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France