裁剪JPG而不将所有内容加载到内存中
问题描述:
如何裁剪大型JPG并提取一小部分?
问题是主要的JPG是如此之大,我无法将所有内容加载到内存中。
我使用了ImageMagick的convert.exe,但它在所有版本的Windows上都没有正常工作,我更喜欢一些C#方法而不是一个独立的exe。
How can I crop a big JPG and extract a small portion of it? The problem is main JPGs are so big and I can't load all of it in memory. I used convert.exe from ImageMagick, but it's not working properly on all versions of windows and I prefer some C# method instead of a standalone exe.
答
我找到了一个不依赖于外部库的命令行解决方案, jpegtran 。
I found a command line solution which does not depend on external libraries, jpegtran.
你可以拥有主exe旁边的 jpegtran.exe 并使用以下参数调用它:
You can have jpegtran.exe beside your main exe and call it with these parameters:
jpegtran -crop WxH+X+Y input_file output_file
从这里下载 jpegtran :
http://jpegclub.org/jpegtran/