Click here to Skip to main content
16,017,100 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I convert a rectangle image to a round image?

I'm new to graphic drawing.

Thank you.
Posted
Updated 29-Mar-10 4:14am
v2

I think you need to provide more information about what you are trying to do. For example ....

What sort of images are you dealing with?
What sort of conversion do you want to achieve ie crop, stretch etc?
 
Share this answer
 
I got it.this code has done it

VB
Private Sub btnExport0_Click()
        Try
            Dim path As String = Server.MapPath(Request.QueryString("imgpath"))
            Dim imgin As System.Drawing.Image = System.Drawing.Image.FromFile(path)
            Dim bitmap As New System.Drawing.Bitmap(imgin.Width, imgin.Height)
            Dim g As Graphics = Graphics.FromImage(bitmap)

            g.Clear(Color.Black)

            Dim brush As New System.Drawing.TextureBrush(imgin)


            g.FillEllipse(brush, New Rectangle(0, 0, imgin.Width, imgin.Height))

            g.Dispose()

            Response.Clear()
            Response.ContentType = "image/pjpeg"
            bitmap.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)
            Response.End()
            bitmap.Dispose()

        Catch ex As Exception

        End Try
    End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900