Creating a uniform border as a percentage of image size … How?
I am wanting to build a script that will allow me to add a black border measuring a uniform width (say 5% of the picture height) for a batch of images of different resolutions and sizes. Problem is, increasing the canvas size by +5% black on a rectangular photo will not produce a border of uniform width. It would also be great if I could add a name and logo (saved as an eps) to the border - something like the picture below. Can this be done as an automated script?
Re: Creating a uniform border as a percentage of image size … How?
It is possible to write a script that does what you ask.
On square photos ther's no problem, because 5% of the Width is the same as 5% of the Height.
On rectangular photos, you need to take 5% of one of the dimentions, and add it to both width and height of the photo, IN PIXELS. For example, if you have a 100x60px photo (Tiny, I know) you calculate that 5% of 100px is 5px. Then you add 10px both to width and to height of the image (10px because you add 5px to left plus 5px to right, and same with up and down).
If you have both portrait and landscape oriented photos, and you want the 5% to always be of the larger side, you need to check wether width>height. If it is, take 5% of width, else take 5% of height.
Adding the EPS to the border is a bit more complicated, because the border is not the same (Width of border is resolution dependant).