저는 .NET에서 간단한 이미지 뷰어를 구축했으며 브라우저에 멀티 프레임 TIFF 이미지를 표시해야합니다. 현재, 멀티 프레임 TIFF와 동일한 데이터베이스에 공동으로 혼합 된 JPEG을 스트리밍하기위한 (ashx) 핸들러 설정이 있으며,이 핸들러가 현재 상태의 TIFF 파일의 첫 번째 프레임을 반환한다는 점을 언급 할 가치가 있습니다 . 아래의 VB.NET 코드 (핸들러의 일부)에서 TIFF 파일에 여러 프레임이 있고 프레임을 함께 스티칭하려고 시도했지만 아직 어떤 성공도 얻지 못했는지 확인할 수 있습니다. 멀티 프레임 TIFF가 비슷한 방식으로 반환 된 사람이 있습니까? 참고 : 아래 코드를 개발할 때 How to open a multi-frame TIFF image을 참조로 사용했습니다.ASP.NET을 사용하여 다중 페이지 TIFF를 스트리밍 (및 변환)
Public Function GetPhoto(ByVal id As String) As List(Of Image)
Dim db As New UtilDb
Dim imageLocation As String
Dim errMsg As String = ""
Dim imageList As New List(Of Image)
Dim returnImage As Bitmap = Nothing
imageLocation = GetFileName(id)
If (imageLocation IsNot Nothing) Then
Dim iFile As Image = Image.FromFile(imageLocation)
If (imageLocation.ToUpper.EndsWith("TIF")) Then
Dim frameCount As Integer = iFile.GetFrameCount(FrameDimension.Page)
Dim i As Integer
If (frameCount > 1) Then
For i = 0 To frameCount - 1
iFile.SelectActiveFrame(FrameDimension.Page, i)
returnImage = New Bitmap(iFile, iFile.Width * 0.4, iFile.Height * 0.4)
imageList.Add(returnImage)
Next i
Else
returnImage = New Bitmap(iFile, iFile.Width * 0.4, iFile.Height * 0.4)
imageList.Add(returnImage)
End If
Else
Dim scaledWidth As Integer = (iFile.Width/iFile.Height) * 480
returnImage = New Bitmap(iFile, scaledWidth, 480)
imageList.Add(returnImage)
End If
iFile.Dispose()
End If
Return imageList
End Function
는 연속 된 이미지의 멀티 프레임 TIFF의 각 프레임을 배치하고 브라우저로 다시 보낼 수 있나요 : 여기
context.Response.Cache.SetCacheability(HttpCacheability.NoCache)
context.Response.Cache.SetNoStore()
context.Response.Cache.SetExpires(DateTime.MinValue)
imageList = GetPhoto(picid)
If (imageList IsNot Nothing) Then
Dim img As Image
Dim prevImageHeight = 0
For Each img In imageList
Dim imgGraphics As Graphics = Graphics.FromImage(img)
imgGraphics.DrawImage(img, 0, prevImageHeight, img.Width, img.Height * imageList.Count)
prevImageHeight += img.Height
img.Save(context.Response.OutputStream, ImageFormat.Jpeg)
img.Dispose()
Next img
Else
' Return 404
context.Response.StatusCode = 404
context.Response.End()
End If
는 GetPhoto 기능에 대한 코드? 다중 프레임 TIFF를 PDF와 같은 다른 형식으로 변환하는데 전력을 집중해야합니까? 본질적으로 전환 패키지 구매에 대한 예산이 없습니다 ... 어떤 도움이나 지침도 크게 감사하겠습니다!