Shafick 0 Denunciar post Postado Agosto 20, 2016 Boas!Estou usando o Microsoft Windows Image Acquisition Library v2.0 (WIA) para digitalizar imagens. Porém, cada imagem está ficando com 25mb em média (jpg, bmp, png, gif ou tiff da na mesma). A ideia é converter para PDF após a digitalização; mesmo assim, o arquivo PDF está ficando com 8mb em média.Pensei então em diminuir a resolução da imagem digitalizada, mas estou encontrando dificuldade para lidar com essa propriedade.Alguém pode ajudar? Ou sugerir alguma outra forma de obter imagens menores em MB?Obrigado.Código da Class usada. Imports WIA Public Class class_cp_Scanner Private ReadOnly _deviceInfo As DeviceInfo Public Sub New(deviceInfo As DeviceInfo) Me._deviceInfo = deviceInfo End Sub Public Function Scan() As ImageFile ' Connect to the device Dim device = Me._deviceInfo.Connect() 'define dialogo para telas de scan (para scan com barra de progresso) Dim dialog = New WIA.CommonDialogClass() ' Start the scan Dim item = device.Items(1) 'scan sem barra de progresso ''''Dim imageFile = DirectCast(item.Transfer(FormatID.wiaFormatJPEG), ImageFile) AdjustScannerSettings(item, 300, 0, 0, 1010, 620, 0, 0) 'scan com barra de progresso Dim imageFile = TryCast(dialog.ShowTransfer(item, WIA.FormatID.wiaFormatJPEG), WIA.ImageFile) ' Return the imageFile Return imageFile End Function Public Overrides Function ToString() As String Return Me._deviceInfo.Properties("Name").Value.ToString ' get_Value().ToString() End Function Public Sub SetWIAProperty(properties As IProperties, propName As Object, propValue As Object) Dim prop As [Property] = properties.get_Item(propName) prop.set_Value(propValue) End Sub Public Sub AdjustScannerSettings(scannnerItem As IItem, scanResolutionDPI As Integer, scanStartLeftPixel As Integer, scanStartTopPixel As Integer, scanWidthPixels As Integer, scanHeightPixels As Integer, _ brightnessPercents As Integer, contrastPercents As Integer) Const WIA_HORIZONTAL_SCAN_RESOLUTION_DPI As String = "6147" Const WIA_VERTICAL_SCAN_RESOLUTION_DPI As String = "6148" Const WIA_HORIZONTAL_SCAN_START_PIXEL As String = "6149" Const WIA_VERTICAL_SCAN_START_PIXEL As String = "6150" Const WIA_HORIZONTAL_SCAN_SIZE_PIXELS As String = "6151" Const WIA_VERTICAL_SCAN_SIZE_PIXELS As String = "6152" Const WIA_SCAN_BRIGHTNESS_PERCENTS As String = "6154" Const WIA_SCAN_CONTRAST_PERCENTS As String = "6155" SetWIAProperty(scannnerItem.Properties, WIA_HORIZONTAL_SCAN_RESOLUTION_DPI, scanResolutionDPI) SetWIAProperty(scannnerItem.Properties, WIA_VERTICAL_SCAN_RESOLUTION_DPI, scanResolutionDPI) SetWIAProperty(scannnerItem.Properties, WIA_HORIZONTAL_SCAN_START_PIXEL, scanStartLeftPixel) SetWIAProperty(scannnerItem.Properties, WIA_VERTICAL_SCAN_START_PIXEL, scanStartTopPixel) SetWIAProperty(scannnerItem.Properties, WIA_HORIZONTAL_SCAN_SIZE_PIXELS, scanWidthPixels) SetWIAProperty(scannnerItem.Properties, WIA_VERTICAL_SCAN_SIZE_PIXELS, scanHeightPixels) SetWIAProperty(scannnerItem.Properties, WIA_SCAN_BRIGHTNESS_PERCENTS, brightnessPercents) SetWIAProperty(scannnerItem.Properties, WIA_SCAN_CONTRAST_PERCENTS, contrastPercents) End Sub End Class Erro obtido na linha: AdjustScannerSettings(item, 300, 0, 0, 1010, 620, 0, 0)An unhandled exception of type 'System.MissingMemberException' occurred in Microsoft.VisualBasic.dllAdditional information: Public member 'get_Item' on type 'PropertiesClass' not found.Referência: http://www.nakov.com/blog/2009/11/17/playing-with-the-scanner-with-wia-and-c/ Usando: VB.NET 2013 Compartilhar este post Link para o post Compartilhar em outros sites