VB.NETでimagemagick変換関数を適切に実行するにはどうすればよいですか?
各引数に明示的に名前を付けてみました
Public Magick As ImageMagickObject.MagickImage
Dim s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11 As String
If IsDBNull(FromImage) Then s1 = "" Else s1 = CStr(FromImage)
If IsDBNull(Rotate1) Then s2 = "" Else s2 = CStr(FromImage)
If IsDBNull(Rotate2) Then s3 = "" Else s3 = CStr(FromImage)
If IsDBNull(Resize1) Then s4 = "" Else s4 = CStr(FromImage)
If IsDBNull(Resize2) Then s5 = "" Else s5 = CStr(FromImage)
If IsDBNull(Extra_Imagemagick_settings) Then s6 = "" Else s6 = CStr(FromImage)
If IsDBNull(Alpha1) Then s7 = "" Else s7 = CStr(FromImage)
If IsDBNull(Alpha2) Then s8 = "" Else s8 = CStr(FromImage)
If IsDBNull(Alpha3) Then s9 = "" Else s9 = CStr(FromImage)
If IsDBNull(Alpha4) Then s10 = "" Else s10 = CStr(FromImage)
If IsDBNull(ToImage) Then s11 = "" Else s11 = CStr(FromImage)
Dim params As String() = {s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11}
Magick.Convert(params)
配列を作成してみました:
Dim params As object() = {FromImage, Rotate1, Rotate2, Resize1, Resize2, Extra_Imagemagick_settings, Alpha1, Alpha2, Alpha3, Alpha4, ToImage}
params = New Object()
ReDim params(20)
params(0) = CStr(FromImage)
params(1) = Rotate1
params(2) = Rotate2
params(3) = Resize1
params(4) = Resize2
params(5) = Extra_Imagemagick_settings
params(6) = Alpha1
params(7) = Alpha2
params(8) = Alpha3
params(9) = Alpha4
params(10) = ToImage
Magick.Convert(params)
「convert()」ディレクトリに引数を付けてフィードしようとしました。
Magick.Convert(FromImage, Rotate1, Rotate2, Resize1, Resize2, Extra_Imagemagick_settings, Alpha1, Alpha2, Alpha3, Alpha4, ToImage)
私が異なる例外を持っているたびに、通常:
Object reference not set to an instance of an object.
また
Use the New keyword to create the instance.
(おそらく私がDOT NETを初めて使用したためです)