#1 (permalink)  
Old 04-30-2010, 12:04 AM
I'm new here!
 
Join Date: Apr 2010
Location: Redmond, WA, USA
Posts: 2
Smile Add border to photo but keep the aspect ratio same

Hi,

I like to add borders to photos for which I have created few actions in photoshop. However for adding borders I have two options:
1. Add symmetric border (for e.g. 1" to all 4 sides)
For e.g. Picasa Web Albums - Charansing - Kelsey Creek ...
2. Add border in percentage of height width to keep the aspect ratio
For e.g. Picasa Web Albums - Charansing - NorthBend Trip

I like the first option because having similar sized borders to all sides looks better. However, this changes my original aspect ratio of the photo.

In second ratio since I use percentage method to add borders, the aspect ratio is maintained but if my photo's height and width are not same (like in 16:9) my borders are never of same size to all sides of the photo.

So my question here is: How can I add border to photo (in photoshop or some other tool) so that I maintain the aspect ratio but still get same sized border to all sides?

You suggestion on this is highly appreciated

- Charan
Picasa Web Albums - Charansing
Reply With Quote
  #2 (permalink)  
Old 04-30-2010, 12:36 AM
dcclark's Avatar
Moderates the loving team
 
Join Date: Feb 2008
Location: Houghton, MI
Posts: 2,359
Default

OK, I'm a mathematician, so I'll probably screw this up. :P

What you want to do is crop the photo into a nonstandard aspect ratio, so that when you use Option #1 (same size borders on all sides), the resulting image DOES have the right ratio! Here's an example calculation.

WARNING: Mathematical content ahead!

Let's say you have an image which is 2000x3000 pixels (that's 2:3 = 4:6 aspect ratio). You want to end up with something in the same ratio. So, you'll have to trim some amount off of both sides -- say, remove x pixels from the 2000px side, and y pixels from the 3000px sides. Then, you'll add the same amount (say, b pixels) to each side for a border. Then:

(2000-x+b)/(3000-y+b) = 2/3

This has many solutions (one equation with 2 variables and a constant, b), but we want the smallest positive values of x and y that make it work. So, first we get rid of the fractions:

3(2000-x+b) = 2(3200-y+b)

Solving for y, we get:

y = (1/2)*(3x-b)

So, you need to pick x to be the smallest positive number which makes 3*x bigger than b. For example:

If you have b = 300 (a border of 300 pixels), then y = (1/2)*(3x-300). So, x = 100 is the smallest that makes this work, and you get x = 100, y = 0. Then you can trim 100 from the 2000 pixel side, and 0 from the 3000 pixel side. When you add a 300px border, you'll have a 2200 x 3300 image, which is in the correct ratio.

SUMMARY:

For 2:3 ratio (most common on digital cameras), find the smallest value of x so that 3x-b is positive. Then crop x from the short edge, and y = (1/2)*(3x-b) from the long edge. Add a border of size b, and you're done.

You can do something similar for other aspect ratios.

Whew! I think I did it! :P
__________________
David Clark Photography, project 365 photo blog, flickr.
It is OK to edit and repost my photos on the DPS forums only.
Reply With Quote
  #3 (permalink)  
Old 04-30-2010, 01:10 AM
I'm new here!
 
Join Date: Apr 2010
Location: Redmond, WA, USA
Posts: 2
Smile

Awesome!!!

Thats really wonderful explanation. But would I be able to add this in my actions?

- Charan
Reply With Quote
  #4 (permalink)  
Old 04-30-2010, 01:18 AM
dPS Forum Member
 
Join Date: Jul 2009
Location: southern oregon, usa
Posts: 50
Default

Not real sure if I understand what you are trying to do.. do you just want a line for a border around the outside of the image? If so,, you can use a stroke or you could add to the canvas size and make it however many pixels wide you like and whatever color you want. ie if you want a 10 pixel border, add 20 pixels to the width and height. DAve
Reply With Quote
  #5 (permalink)  
Old 04-30-2010, 01:21 AM
dcclark's Avatar
Moderates the loving team
 
Join Date: Feb 2008
Location: Houghton, MI
Posts: 2,359
Default

Quote:
Originally Posted by dave_lines View Post
Not real sure if I understand what you are trying to do.. do you just want a line for a border around the outside of the image? If so,, you can use a stroke or you could add to the canvas size and make it however many pixels wide you like and whatever color you want. ie if you want a 10 pixel border, add 20 pixels to the width and height. DAve
The OP wanted a border of a fixed size, as you said. However, if (for example) you add a 20 pixel border to a 2000x3000 image, then the new image is 2020x3020, which is no longer in the 2:3 aspect ratio. The OP wanted to find a way to add a border AND keep the right ratio.

Also, no clue about actions, sorry.
__________________
David Clark Photography, project 365 photo blog, flickr.
It is OK to edit and repost my photos on the DPS forums only.
Reply With Quote
  #6 (permalink)  
Old 04-30-2010, 01:52 AM
OsmosisStudios's Avatar
Don't Panic
 
Join Date: Sep 2008
Location: Mississauga / Ottawa
Posts: 11,358
Default

You could also always add a border INSIDE the image.

In the 3000x2000 with a 20px border example, you'd end up with an image that was the same size (ie 3000x2000) but you'd also have a 20px border on all sides. That means you'd end up losing 40 px per side, but that's not that much in the grand scheme of things.
__________________
I am responsible for what I say; not what you understand.
OsmosisStudios
Gear List
Reply With Quote
  #7 (permalink)  
Old 04-30-2010, 01:53 AM
dcclark's Avatar
Moderates the loving team
 
Join Date: Feb 2008
Location: Houghton, MI
Posts: 2,359
Default

Quote:
Originally Posted by OsmosisStudios View Post
You could also always add a border INSIDE the image.

In the 3000x2000 with a 20px border example, you'd end up with an image that was the same size (ie 3000x2000) but you'd also have a 20px border on all sides. That means you'd end up losing 40 px per side, but that's not that much in the grand scheme of things.
That's a ridiculously simple and easy idea! Come on man, we have to preserve the mystique of mathematics!
__________________
David Clark Photography, project 365 photo blog, flickr.
It is OK to edit and repost my photos on the DPS forums only.
Reply With Quote
  #8 (permalink)  
Old 04-30-2010, 11:10 AM
wulf's Avatar
Ninja Moderator
 
Join Date: Dec 2006
Location: Oxford, UK
Posts: 9,830
Default

Inside would have been my choice as well (as much as the maths appeals!). Select the whole image and then shrink the selection by an appropriate amount. That will also mean the resulting image still prints at the same size for a given DPI setting.

If, of course, you really need a border in the first place. I'd rather leave putting on a border until when I am mounting and displaying the image for a particular purpose rather than embedding it in the image.

Wulf
__________________
Wulf Forrester-Barker << Sites: blog / flickr >>
Gear: Nikon D40, Nikon AFS 18-55mm f/3.5 - 5.6G, Nikon Series E 50mm f/1.8, Nikon AF 70-300mm f/4-5.6G, Vivitar 90mm f/2.5 macro, Raynox DCR-250, Lensbaby 2.0k, SB600
Reply With Quote
  #9 (permalink)  
Old 05-01-2010, 08:47 PM
Black Hole Hunter
 
Join Date: Jan 2010
Posts: 203
Default

Of course an even easier way would be to make square crops of the photos... bloody mathemeticians over-thinking again!
__________________
"There can be few professions outside of artificial insemination and parachuting where equipment is as crucial as it is for a photohrapher"- Roy Mallard
Reply With Quote
  #10 (permalink)  
Old 05-01-2010, 09:08 PM
elkidogz's Avatar
dPS Forum Member
 
Join Date: Sep 2009
Location: Cincinnati, Ohio
Posts: 240
Default

Quote:
Originally Posted by wulf View Post
Inside would have been my choice as well (as much as the maths appeals!). Select the whole image and then shrink the selection by an appropriate amount. That will also mean the resulting image still prints at the same size for a given DPI setting.

If, of course, you really need a border in the first place. I'd rather leave putting on a border until when I am mounting and displaying the image for a particular purpose rather than embedding it in the image.

Wulf
I agree with Wulf here. I try to only put a border on images where either they make an impact on the content of the image, or it's going onto the wall. otherwise leave the image to stand to the edge of the file.
__________________
Thanks,

Elkidogz
Nikon D80, D60, 775
Review my photos at: Flickr
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off



Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

What’s Your Preference?

Daily Digest

Each day we send out a quick email to thousands of DPS readers to notify them of updates. This email is just short excerpt of the first few lines of our latest post with a link if you want to read it all. You can unsubscribe from this this service at any time.

This service is provided by a third party (Feedburner) and you can subscribe to it by leaving your email address in the following field and confirming your subscription when you get an email asking you to do so.

Enter your email address for
Daily Updates:

Weekly Summary

For those wanting a weekly summary of what happens on this site this free email newsletter is probably your best option. It includes a summary of the tips posted to the site each week. This newsletter is subscribed to by over 25000 readers (many who also subscribe to the other options above) - come join the community!

To subscribe to this weekly newsletter simply add your email address to the following field and then follow the confirmation prompts. You will be able to unsubscribe at any time.

Enter your email address for
Free Weekly Newsletter:

 
SEO by vBSEO 3.3.0