在 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 的新手)