gpt4 book ai didi

png - Rust 中的图像处理库

转载 作者:行者123 更新时间:2023-11-29 08:19:35 29 4
gpt4 key购买 nike

我正在尝试用 Rust 为类(class)项目制作一个基本的图像处理程序,但我不知道如何开始。我研究过使用 rust-png , 但我很难理解如何将它用作外部库,因为我不确定我是否正确链接了文件。当我编译 lib.rs 以创建 crate 时,出现此错误。

error: linking with `cc` failed: exit code: 1
note: cc arguments: '-m64' '-L/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-o' 'main' 'main.o' '-lmorestack' '-nodefaultlibs' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libnative-83574243-0.11-pre.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libstd-aad93cea-0.11-pre.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/liblibc-8f65d5a8-0.10-pre.rlib' '-L/Users/brianuosseph/Desktop/Course_Work/Spring_2014/CS_4414/final_project/.rust' '-L/Users/brianuosseph/Desktop/Course_Work/Spring_2014/CS_4414/final_project' '-lpng' '-lz' '-lshim' '-lSystem' '-lc' '-lm' '-Wl,-rpath,@loader_path/../../../../../../../usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-Wl,-rpath,/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lcompiler-rt'
note: ld: warning: directory not found for option '-L/Users/brianuosseph/Desktop/Course_Work/Spring_2014/CS_4414/final_project/.rust'
ld: library not found for -lshim
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error

我目前正在运行 Rust 的 0.11-pre-nightly 构建。

对于这个项目,我只是从使用 libpng 包装开始,但将来我更愿意从头开始,为 Rust 创建我自己的 PNG 库。然而,我只是不知道从哪里开始,或者是否有任何现有的 Rust 图像库,无论是 PNG、GIF 还是 JPEG。知道吗?

最佳答案

我为 LodePNG 写了一个包装器:

https://lib.rs/lodepng

它不需要任何外部库(除了它包含的静态链接的 lodepng.c 之外),因此链接它应该没有任何问题。


我还为 MozJPEG 编写了绑定(bind)和 makefile,它为您提供了一个低级的 libjpeg API:

https://lib.rs/mozjpeg-sys

关于png - Rust 中的图像处理库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22997888/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com