相关疑难解决方法(0)

并行化GDI +图像大小调整.net

我试图使用.Net并行调整jpegs的大小.我的所有尝试都失败了,因为Graphics.DrawImage-func似乎在激活时锁定.尝试以下剪切:

Sub Main()
    Dim files As String() = IO.Directory.GetFiles("D:\TEMP")
    Dim imgs(25) As Image
    For i As Integer = 0 To 25
      imgs(i) = Image.FromFile(files(i))
    Next

    Console.WriteLine("Ready to proceed ")
    Console.ReadLine()

    pRuns = 1
    For i As Integer = 0 To 25
      Threading.Interlocked.Increment(pRuns)
      Threading.ThreadPool.QueueUserWorkItem(New Threading.WaitCallback(AddressOf LongTerm), imgs(i))
    Next
    Threading.Interlocked.Decrement(pRuns)

    pSema.WaitOne()
    Console.WriteLine("Fin")
    Console.ReadLine()
  End Sub

  Sub LongTerm(ByVal state As Object)
    Dim newImageHeight As Integer
    Dim oldImage As Image = CType(state, Image)
    Dim newImage As Image
    Dim graph As Graphics
    Dim rect As …
Run Code Online (Sandbox Code Playgroud)

.net multithreading jpeg gdi+ resize

15
推荐指数
3
解决办法
6767
查看次数

标签 统计

.net ×1

gdi+ ×1

jpeg ×1

multithreading ×1

resize ×1