PDA

View Full Version : Zoom on image



guest
02-11-2005, 12:40 PM
Wich is the best method for zooming tiff file??

Chris
02-11-2005, 12:46 PM
first, read the file to an RGB image:


hSrc = IS3OpenFileSource(sFilename)
m_RGB = IS3ReadTIFF(hSrc, uWidth, uHeight, 24, ByVal 0, 0, 0)
IS3CloseSource hSrc


then, resize it (from the Help File):


Dim tRGB As Long
Dim newWidth As Long, newHeight As Long
If m_RGB Then

' Resize the image to a maximum size of 200 x 200.
If m_Width > 200 Or m_Height > 200 Then

' Get the new width and height so the image won't look screwy.
If m_Width > m_Height Then
newWidth = 200
newHeight = (m_Height * newWidth) / m_Width
Else
newHeight = 200
newWidth = (m_Width * newHeight) / m_Height
End If

' Create an image buffer
tRGB = GlobalAlloc(&H0, newWidth * newHeight * 3)

' Resize the image. Simply change the last parameter for other filter types.
If IS3ResizeFilterImage(m_RGB, m_Width, m_Height, m_Width * 3, _
tRGB, newWidth, newHeight, newWidth * 3, 3, 8) Then
GlobalFree m_RGB
m_RGB = tRGB
m_Width = newWidth
m_Height = newHeight
picImage.Cls
picImage_Paint
Else
' Oops!
MsgBox "IS3GetLastError returns " & IS3GetLastError(), , "Resize Failed"
GlobalFree tRGB
End If

Else
MsgBox "This image is already less than 200 x 200 pixels.", vbInformation, "Resize Cancelled"
End If

End If


then save it...