Наши проекты:
Журнал · Discuz!ML · Wiki · DRKB · Помощь проекту |
||
ПРАВИЛА | FAQ | Помощь | Поиск | Участники | Календарь | Избранное | RSS |
[18.222.164.246] |
|
Сообщ.
#1
,
|
|
|
Почему изменяется resolution при сохранении рисунка?
Imports System.Drawing.Printing Imports System.Drawing.Imaging Public Class testimage Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim strFileName As String = "F:\me.tif" Dim bareFileName As String Dim Ext As String Dim img As System.Drawing.Image = System.Drawing.Image.FromFile(strFileName) 'get the codec for tiff files Dim info As ImageCodecInfo = Nothing Dim ice As ImageCodecInfo For Each ice In ImageCodecInfo.GetImageEncoders() Response.Write("<br>" & ice.MimeType) If ice.MimeType = "image/tiff" Then info = ice End If Next ice 'use the save encoder Dim enc As Encoder = Encoder.SaveFlag Dim ep As New EncoderParameters(1) ep.Param(0) = New EncoderParameter(enc, CLng(EncoderValue.MultiFrame)) Dim i As Integer For i = 0 To img.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page) - 1 img.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, i) Dim size As System.Drawing.Size size.Height = img.Height size.Width = img.Width Dim bm As New System.Drawing.Bitmap(img) Dim gr As System.Drawing.Graphics = _ System.Drawing.Graphics.FromImage(bm) 'gr.DrawImage(img, 0, 0) Dim font As System.Drawing.Font = New System.Drawing.Font("Impact", 15) gr.DrawString("123456789", font, Brushes.Black, 100, 100) If i = 0 Then bareFileName = Mid(strFileName, 1, InStr(strFileName, ".") - 1) Ext = Mid(strFileName, InStr(strFileName, ".")) bm.Save(bareFileName & "_" & Ext, info, ep) End If gr.Dispose() bm.Dispose() Next i img.Dispose() End Sub End Class |
Сообщ.
#2
,
|
|
|
M Используем тег [code] для добавление текста программы в пост! Устное предупреждение! Читаем правила! |