I am using Visual Basic in VS2010 and am having issues getting COM+ to work. I have the following code which doesn;t appear to be working. The conversion never happens. If I copy the string generated and place it in a command window then it works fine. Anyway, the code...
Code: Select all
Private Sub polymorphImage(ByRef imagePath As String, ByRef pictureBox As PictureBox, ByRef refPoints As Point())
Dim tempImage As ImageMagickObject.MagickImage = New ImageMagickObject.MagickImage()
Dim newFile As String = My.Computer.FileSystem.GetFileInfo(imagePath).DirectoryName + "\mbcg_preview.png"
Dim imageWidth As Integer = 0
Dim imageHeight As Integer = 0
For Each pointCheck In refPoints
If (pointCheck.X > imageWidth) Then
imageWidth = pointCheck.X
End If
If (pointCheck.Y > imageHeight) Then
imageHeight = pointCheck.Y
End If
Next
Dim commandString As String = Chr(34)
commandString += imagePath
commandString += Chr(34) + " "
commandString += "-virtual-pixel transparent -resize "
commandString += imageWidth.ToString + "x" + imageHeight.ToString + " " 'Resize
commandString += "-distort perspective "
commandString += Chr(34)
commandString += "0,0 " 'SUL
commandString += refPoints(topLeft).X.ToString + "," + refPoints(topLeft).Y.ToString + " " 'DUL
commandString += "0," + imageWidth.ToString + " " 'SLL
commandString += refPoints(bottomLeft).X.ToString + "," + refPoints(bottomLeft).Y.ToString + " " 'DLL
commandString += imageWidth.ToString + ",0 " 'SUR
commandString += refPoints(topRight).X.ToString + "," + refPoints(topRight).Y.ToString + " " 'DUR
commandString += imageWidth.ToString + "," + imageHeight.ToString + " " 'SLR
commandString += refPoints(bottomRight).X.ToString + "," + refPoints(bottomRight).Y.ToString 'DLR
commandString += Chr(34) + " "
commandString += Chr(34)
commandString += newFile
commandString += Chr(34)
executeCommand.Text = commandString
MessageBox.Show(tempImage.Convert(commandString))
Dim newImage As Image = Image.FromFile(newFile)
pictureBox.BackgroundImage = newImage
pictureBox.Invalidate()
End Sub
Code: Select all
"\\Aitsl-nas\iso 1\After Life (2009)\folder.jpg" -virtual-pixel transparent -resize 343x410 -distort perspective "0,0 0,0 0,343 0,410 343,0 343,0 343,410 343,410" "\\Aitsl-nas\iso 1\After Life (2009)\mbcg_preview.png"
Any help greatly appreciated!