如何将矩形图像转换为圆形图像 [英] How to Convert Rectangle image to round Image

查看:84
本文介绍了如何将矩形图像转换为圆形图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将矩形图像转换为圆形图像?

我是图形绘制的新手.

谢谢.

How can I convert a rectangle image to a round image?

I''m new to graphic drawing.

Thank you.

推荐答案

我认为您需要提供有关您尝试执行的操作的更多信息.例如....

您正在处理哪种图像?
您想实现哪种转换,即裁剪,拉伸等?
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?


我明白了.这段代码已经实现了

I got it.this code has done it

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


这篇关于如何将矩形图像转换为圆形图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆