jpeg_read_header libjpeg 的替代品
所以我在 Windows 上使用 libjpeg 时遇到了一个问题,导致 jpeg_read_header() 崩溃。
问题描述如下(相当搞笑): http:// /sourceforge.net/projects/gnuwin32/forums/forum/74807/topic/1629371?message=4053776
我决定使用第三个选项,该选项不使用 jpeg_stdio_src/dest API。然而,经过多次谷歌搜索,我似乎找不到帖子末尾提到的“将数据输入 libjpeg 的其他方法”,有人能指出我正确的地方吗?
So I'm running into an issue using libjpeg on Windows which causes jpeg_read_header() to crash.
The problem is (fairly hilariously) described here: http://sourceforge.net/projects/gnuwin32/forums/forum/74807/topic/1629371?message=4053776
I've decided on the 3rd option, which is not using jpeg_stdio_src/dest APIs. However, after much googling, I can't seem to find the 'other ways to feed data into libjpeg' mentioned at the end of the post, can anyone point me to the right place?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
有人举报针对在较新的 Visual Studio 中链接 msvcrt 的问题的解决方法。通过谷歌搜索msvcrt.dll“Visual Studio”找到
Sompe people report a workaround for the issue with linking against msvcrt in newer visual studio's. Found by googling msvcrt.dll "visual studio"
“提供数据的其他方法”之一是以下函数:
One of the "other ways to feed data" is these functions:
如果我正确理解这个问题,那是因为 Windows 中所有各种文件句柄之间的差异。它们并不都彼此兼容。
这个链接会有帮助吗?它告诉您如何在它们之间进行转换。然后,您可以为该函数提供正确类型的文件句柄并使其运行。
http://www.codeproject.com/KB/files/handles.aspx
或者,不要使用该 jpeg 库并使用另一个库。我可以特别推荐没有,因为我以前不需要使用 jpeg 库。
If I understand the problem correctly it's because of the differences between all the various file handles in windows. They are not all compatible with each other.
Would this link be of help? it tells you how to convert between them all. You can then provide the correct kind of file handle to the function and get it running.
http://www.codeproject.com/KB/files/handles.aspx
Alternatively, don't use that jpeg library and use another. There are none I can specifically recommend as I haven't had a need to use a jpeg library before.
我最近在使用 libjppeg-turbo 时遇到了同样的问题。我不想重新编译库或将 mscvr.dll 链接到我的 vs2015 应用程序。
这个函数对我有用:
jpeg_mem_src(...)
,而不是使用jpeg_stdio_src
。由于它不会将任何 C 运行时结构传递给库,因此它工作得很好。函数定义可以在这里找到链接从内存缓冲区而不是文件获取输入数据,如果您的文件不太大/内存不太重要,那么它就可以工作。
I ran into the same problem recently with libjppeg-turbo. I did not want to recompile the library or link mscvr.dll to my vs2015 app.
This function worked for me:
jpeg_mem_src(...)
instead of usingjpeg_stdio_src
. Since it doesn't pass any C runtime structures to the library, it works just fine. The function definition can be found here linkIt gets the input data from a memory buffer instead of a file, which works if your file isn't too big/memory isn't too much of a concern.
我遇到了类似的问题,并在寻找解决方案时看到了这篇文章。最终,我只是搞乱了代码,因为直接从文件读取对我来说至关重要。为了解决这个问题,我做了以下操作:
这两个函数在执行此操作后工作正常并且符合预期...我不确定为什么这解决了我的问题,但我会接受它。希望这对其他人有帮助。
I had a similar issue and came across this post when looking for solutions. Ultimately, I just messed around with the code because it was crucial for me to read directly from file. To fix, I did the following:
The two functions work fine and as expected after doing this... I'm not sure why this fixed my issue, but I'll take it. Hope this helps someone else.