How to add a circle in a square and have it ‘snap’ to the boundaries?

P
Posted By
PortyPorty
Sep 2, 2007
Views
943
Replies
14
Status
Closed
Photoshop CS2.

I’ve created a new image that is 100 x 100 mm. Now I want to create a new 100mm diameter circular shape inside that first square, that will automatically align itself to the edges of my original 100mm square image.

But I can’t align the circle within the square.

At first, all I thought that I needed to do was to create the first image (100mm x 100mm), then go to the Eliptical Marquee tool, with a fixed size of 100mm x 100mm, and drag my circle inside the 100mm sq. image.

But I can’t get the circle to align itself correctly with the boundaries of the original square image.

OK, I can do it manually but that could be off by many pixels – is there a way of doing this accurately with Photoshop??

Master Retouching Hair

Learn how to rescue details, remove flyaways, add volume, and enhance the definition of hair in any photo. We break down every tool and technique in Photoshop to get picture-perfect hair, every time.

JJ
John_Joslin
Sep 2, 2007
Pull out guides to the boundaries of the square.

Turn on "Snap to Guides".

Draw the circle with origin at the top left of the square.
P
PortyPorty
Sep 2, 2007
Thanks for that. But I’ve tried doing as you suggest and can’t seem to make it work.

Maybe I’m expecting too much – like, I would have thought that a ‘snap-to’ function would be like a magnet and automatically pull the item towards the guides or boundaries with a definite, visible ‘movement’?

But I can’t see it happening, even if I zoom in real close with Ctrl\Alt\+. (And I’ve either activated and placed the guides, or used ‘Document Boundaries’ from the View menu).

If I release the circle (of marching ants)when it gets close to the guides or edge of the box (say 1mm or 2mm away), I would have thought it’d ‘snap’ the rest of the way. But no.

I must be doing something majorly wrong 🙁
JJ
John_Joslin
Sep 2, 2007
I see now you mentioned marching ants.

Don’t use a selection – use a custom shape with the "Paths" option.
P
PortyPorty
Sep 3, 2007
Thanks again. Sorry, but what you’re telling me is beyond my meager PShop abilities.

Guess I’ll just have to stick to dragging a fixed size elipse into the square and eyeball it for accuracy of location.

Cheers 🙂
JJ
John_Joslin
Sep 3, 2007
If you said what you are trying to get as an end product, how you want to use the circle-in-a-square, it would be possible to help more.
GH
Gernot_Hoffmann
Sep 3, 2007
PortyPorty,

it’s possible like this, here for 72ppi:

1. Define new doc by pixels
p = (72/25.4mm)*100mm = 283.46
2. Use nearest odd number: px=py=283
3. View/Snapto/Document bounds
4. Draw any (smaller) ellipse
5. Path select (black arrow), shows 4 points
6. Edit/Free transform path
7. Drag top point to top border, left to
left, an so on.
The points will snap to the borders
8. Apply transform
9. Workpath/Make selection
10.e.g. Feather 0, No anti-aliasing
11.Edit/Stroke 1px
12.Select/Deselect

This delivers a circle with 1 px stroke
which is almost symmetric. Long ago it
was discussed here that the circle isn’t
perfectly symmetric. This is a minor bug
which doesn’t hurt for practical appli-
cations.

Best regards –Gernot Hoffmann
JJ
John_Joslin
Sep 3, 2007
GH
Gernot_Hoffmann
Sep 3, 2007
John,

my test was done by PhS7. The simple
method didn’t work, therefore the free
transform.
In CS2 it is as you say. But you don’t
need guides – just Snap To Borders.
Your circle is (sorry) not accurate.
IMO it’s necessary to define width and
height by the same odd number of pixels.

The circle is then perfectly symmetric
(in CS2) and accurately centered.

Best regards –Gernot Hoffmann
GD
george_dingwall
Sep 3, 2007
Hi PortyPorty,

I have a small script which will place a selection on any size or shape of image that will touch all four sides.

You can run the script from an action and allocate a function key to instantly place the selection.

If you want to give it a try, let me know and I’ll email you a copy. You can find my email address on my homepage.

<http://www.georgedingwall.co.uk/>

Bye for now.
JJ
John_Joslin
Sep 3, 2007
Your circle is (sorry) not accurate.

True. I was just illustrating a principle.

Not knowing the ultimate purpose of PortyPorty I did not go further.
P
PECourtejoie
Sep 3, 2007
CS2 has smart guides, did you turn it on?
JJ
John_Joslin
Sep 3, 2007
No, just Snap to guides.

Gernot’s method of fixed odd pixels sizes is the best.

On-screen rendering can give a misleading impression.
P
PortyPorty
Sep 3, 2007
Many thanks to all who’ve responded. I’ll expand a little on what I was trying to do, in case it affects someone’s answer.

I frequently create CD labels and print the discs in my Canon MP830.

I’ve found that a good base label, one which lets me see how much space is available for text and other graphics, is one with two rings. The outer ring is at the extreme outer edge of the disc label and the inner ring is at the inner limits of the printable surface. With the discs I use, the inner, unprintable central hub is 22mm wide. The rings are formed by a stroke, 6px wide. The outer disc diameter is 119mm.

I begin with a new image 22mm x 22mm, 300 dpi with a white BG. (I know I said 100mm but I was trying to discover the principle)The color pallette at left has a white BG and an FG color of my intended stroke, in this case,mid-blue.

Then, into that square image I’ve been dropping a circle (using the ellipse tool)with a fixed size of 22mm x 22mm. It’s this circle that I’ve trying to locate accurately, instead of by eye.

Then I stroke the circle, 6px wide and that finishes the inner circle.

The next move is to increase the canvas size to 119mm x 119mm. Then I add the second circle, fixed size 119mm x 119mm and stroke that.

The finished result is a 119mm square image containing an outer blue ring and an inner blue ring. From there I go on and add gradient fill, buttons, boxes, text etc.

Thanks again to you all for your comments 🙂
GD
george_dingwall
Sep 4, 2007
Hi PortyPorty,

Thanks for the additional info.

I’ve modified my script a little to do what you want. I’ve emailed you a copy direct as per your off group email.

It creates a new document that is 119mm square at 300 dpi.

It then adds the outer and inner stroked circles at 6 pixels and uses a blue colour for the stroke.

You need to put the script in your Photoshop scripts folder. On my machine this is the required location. The version of Photoshop in the path should be amended to show the version you use.

C:\Program Files\Adobe\Adobe Photoshop CS2\Presets\Scripts

I don’t recall if you said which version of Photoshop you use, but this script works on CS1, CS2 and CS3. I don’t have PS7 on my machine so can’t tell you if it will work with that version.

All you need to do to run the script is to choose
File/Scripts/CDLabel from the list of available scripts. You can also run this script from an action. You could then allocate a function key to speed up the process a little.

Hope this helps.

How to Improve Photoshop Performance

Learn how to optimize Photoshop for maximum speed, troubleshoot common issues, and keep your projects organized so that you can work faster than ever before!

Related Discussion Topics

Nice and short text about related topics in discussion sections