<legend id='93fsa'><style id='93fsa'><dir id='93fsa'><q id='93fsa'></q></dir></style></legend>
  • <small id='93fsa'></small><noframes id='93fsa'>

    <tfoot id='93fsa'></tfoot>
    <i id='93fsa'><tr id='93fsa'><dt id='93fsa'><q id='93fsa'><span id='93fsa'><b id='93fsa'><form id='93fsa'><ins id='93fsa'></ins><ul id='93fsa'></ul><sub id='93fsa'></sub></form><legend id='93fsa'></legend><bdo id='93fsa'><pre id='93fsa'><center id='93fsa'></center></pre></bdo></b><th id='93fsa'></th></span></q></dt></tr></i><div id='93fsa'><tfoot id='93fsa'></tfoot><dl id='93fsa'><fieldset id='93fsa'></fieldset></dl></div>
      <bdo id='93fsa'></bdo><ul id='93fsa'></ul>

        Azure 函数抛出“参数无效";在大型 TIF 文件上调用 Image.FromStream

        Azure function throwing quot;parameter not validquot; calling Image.FromStream on large TIF file(Azure 函数抛出“参数无效;在大型 TIF 文件上调用 Image.FromStream)
          <bdo id='nXY9r'></bdo><ul id='nXY9r'></ul>

            <small id='nXY9r'></small><noframes id='nXY9r'>

            1. <tfoot id='nXY9r'></tfoot>

                    <tbody id='nXY9r'></tbody>

                • <i id='nXY9r'><tr id='nXY9r'><dt id='nXY9r'><q id='nXY9r'><span id='nXY9r'><b id='nXY9r'><form id='nXY9r'><ins id='nXY9r'></ins><ul id='nXY9r'></ul><sub id='nXY9r'></sub></form><legend id='nXY9r'></legend><bdo id='nXY9r'><pre id='nXY9r'><center id='nXY9r'></center></pre></bdo></b><th id='nXY9r'></th></span></q></dt></tr></i><div id='nXY9r'><tfoot id='nXY9r'></tfoot><dl id='nXY9r'><fieldset id='nXY9r'></fieldset></dl></div>

                  <legend id='nXY9r'><style id='nXY9r'><dir id='nXY9r'><q id='nXY9r'></q></dir></style></legend>
                • 本文介绍了Azure 函数抛出“参数无效";在大型 TIF 文件上调用 Image.FromStream的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试在 Azure 函数中处理多页 TIF.该函数由 blob 存储的更改触发.当触发器运行时,它会调用:

                  I'm trying to process multi-page TIFs in an Azure Function. The function is triggered by changes in blob storage. When the trigger runs, it calls this:

                  function loadFile(Stream mpTif);
                       Bitmap pageOnes = (Bitmap)Image.FromStream(mpTif);
                  

                  mpTif 是直接传递到 Azure 函数的 blob 存储流.

                  mpTif is the blob storage Stream being passed directly into the Azure Function.

                  我的函数在小型多页 TIF 文件上运行良好,但是当我将一个非常大的 TIF 文件放入 blob 存储时,它在 Image.FromStream 上失败并出现错误:

                  My function works fine on small multi-page TIF files but when I put a very large one in the blob storage, it fails on Image.FromStream with the error:

                  参数无效

                  我正在使用本地功能主机在我自己的机器上运行它.奇怪的是,我有一个控制台应用程序,它使用完全相同的代码运行,但使用 MemoryStream 调用它:

                  I am running this on my own machine using the local function host. The strange thing is that I have a console application which runs using the exact same code but calls it using a MemoryStream instead:

                  MemoryStream data = new MemoryStream(File.ReadAllBytes("big.tif"));
                  loadFile(data);
                  

                  这很好用.我是否在 Azure Functions 中达到某种内存限制?在我遇到那个错误之前花了很长时间,这让我觉得这是一个 OOM 的事情.此 TIF 文件非常大(80Mb 和 10,000 页).

                  This works fine. Am I hitting some sort of memory limit in Azure Functions? It takes suspiciously long before I hit that error, which makes me think it's an OOM thing. This TIF file is very large (80Mb and 10,000 pages).

                  推荐答案

                  我明白了 - 事实证明位图操作在运行 blob 流时一点也不开心.性能很糟糕(可能慢了 100 倍),对大文件的操作会因我上面提供的错误而失败.

                  I got to the bottom of this - it turns out Bitmap operations are not at all happy running off the blob Streams. The performance is terrible (perhaps 100 times slower) and operations on large files just fail with the error I provided above.

                  我通过使用 https://stackoverflow.com/提供的代码将传入 Stream 复制到 MemoryStream 解决了我的所有问题a/3212765/498949 在对其执行任何位图操作之前.

                  I resolved all of my issues by copying the incoming Stream to a MemoryStream using the code provided at https://stackoverflow.com/a/3212765/498949 before performing any Bitmap operations on it.

                  这篇关于Azure 函数抛出“参数无效";在大型 TIF 文件上调用 Image.FromStream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Adding and removing users from Active Directory groups in .NET(在 .NET 中的 Active Directory 组中添加和删除用户)
                  How do you determine if two HashSets are equal (by value, not by reference)?(您如何确定两个 HashSet 是否相等(按值,而不是按引用)?)
                  Is there a quot;Setquot; data structure in .Net?(有没有“套路?.Net 中的数据结构?)
                  Collection that allows only unique items in .NET?(仅允许 .NET 中唯一项目的集合?)
                  Adding headers in ASP.NET MVC 3(在 ASP.NET MVC 3 中添加标头)
                  Response.Redirect strips Header Referrer - Possible to Add it Back?(Response.Redirect 剥离 Header Referrer - 可以将其添加回来吗?)
                      <tbody id='eZskp'></tbody>
                    <tfoot id='eZskp'></tfoot>
                    • <bdo id='eZskp'></bdo><ul id='eZskp'></ul>
                      • <legend id='eZskp'><style id='eZskp'><dir id='eZskp'><q id='eZskp'></q></dir></style></legend>

                        <small id='eZskp'></small><noframes id='eZskp'>

                        <i id='eZskp'><tr id='eZskp'><dt id='eZskp'><q id='eZskp'><span id='eZskp'><b id='eZskp'><form id='eZskp'><ins id='eZskp'></ins><ul id='eZskp'></ul><sub id='eZskp'></sub></form><legend id='eZskp'></legend><bdo id='eZskp'><pre id='eZskp'><center id='eZskp'></center></pre></bdo></b><th id='eZskp'></th></span></q></dt></tr></i><div id='eZskp'><tfoot id='eZskp'></tfoot><dl id='eZskp'><fieldset id='eZskp'></fieldset></dl></div>