PC Review


Reply
Thread Tools Rate Thread

Crop a circle image from a square picture

 
 
Crirus
Guest
Posts: n/a
 
      3rd Oct 2003
I have a square picture. I need to draw a circle on it, and everything
outside that circle to be set to a certain color, so the image looks framed

On other words, I want to crop a circle form a rectangular picture

Any hints?


 
Reply With Quote
 
 
 
 
Andreas Lundgren
Guest
Posts: n/a
 
      3rd Oct 2003
If it's a not huge image and it's not an old computer, the
straight forward solution is just to run over the picture
and compare pixel by pixel. Like the pseudocode here:

ry = heightInNbrOfPixels / 2
ry = widthInNbrOfPixels / 2
rSqr = min(heightInNbrOfPixels ,widthInNbrOfPixels) * _
min(heightInNbrOfPixels ,widthInNbrOfPixels)
for y = 1 to heightInNbrOfPixels
for x = 1 to widthInNbrOfPixels
if y*y + x*x > rSqr then _
setPixel(x,y) = white
next x
next y

>-----Original Message-----
>I have a square picture. I need to draw a circle on it,

and everything
>outside that circle to be set to a certain color, so the

image looks framed
>
>On other words, I want to crop a circle form a

rectangular picture
>
>Any hints?
>
>
>.
>

 
Reply With Quote
 
One Handed Man
Guest
Posts: n/a
 
      3rd Oct 2003
I havent looked, but when you do this on most graphics editors, you can fill
the area outside the circle, have you looked thru the libraries ( you
probably have, but just checking )

OHM

Crirus wrote:
> I have a square picture. I need to draw a circle on it, and everything
> outside that circle to be set to a certain color, so the image looks
> framed
>
> On other words, I want to crop a circle form a rectangular picture
>
> Any hints?



 
Reply With Quote
 
Fergus Cooney
Guest
Posts: n/a
 
      3rd Oct 2003
Hi Crirus,

Draw a circle with a very, very wide brush.

Regards,
Fergus


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      4th Oct 2003
"Andreas Lundgren" <(E-Mail Removed)> scripsit:
>> I have a square picture. I need to draw a circle on it,

> and everything
>> outside that circle to be set to a certain color, so the

> image looks framed
>>
>> On other words, I want to crop a circle form a

> rectangular picture


Create an appropriate 'Region' from a 'GraphicsPath' and assign it to
the 'Graphics' object's 'Clip' property. Then draw the image onto the
canvas (filled with a solid brush before).

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can I crop in a circle using power point? =?Utf-8?B?UGF1bGFK?= Microsoft Powerpoint 2 21st Nov 2007 08:48 PM
circle, square & triangle where picture should be =?Utf-8?B?TU85ODc2NTQ=?= Microsoft Outlook Discussion 0 11th Sep 2007 11:30 AM
Small square icon w/ red square, green circle & blue triangle insi =?Utf-8?B?Um9iZXJ0IEg=?= Windows XP Basics 0 7th May 2005 05:23 AM
can I crop a photo into a circle on a PC? =?Utf-8?B?anJlYmVjY2Ft?= Microsoft Powerpoint 5 1st Nov 2004 10:34 PM
Triangle, Square, Circle Jono Windows XP Internet Explorer 1 18th Sep 2003 10:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:44 AM.