Lenna is a library for image processing algorithms and apps.
This is the core library for lenna.
sh
cargo build
sh
cargo test
cargo test --features=python
wasm-pack test --node
```rust use image::DynamicImage; use lennacore::core::processor::Processor; use lennacore::plugins::PluginRegistrar; use lennacore::ImageProcessor; use lennacore::ExifProcessor; use lenna_core::ProcessorConfig;
lennacore::exportplugin!(register);
extern "C" fn register(registrar: &mut dyn PluginRegistrar) { registrar.add_plugin(Box::new(Plugin{ config: Config::default() })); }
struct Config { }
pub struct Plugin { config: Config }; impl Processor for Plugin { fn name(&self) -> String { "plugin".into() }
fn title(&self) -> String {
"Plugin".into()
}
fn author(&self) -> String {
"chriamue".into()
}
fn description(&self) -> String {
"Plugin description.".into()
}
fn process(
&mut self,
config: ProcessorConfig,
image: &mut Box<lenna_core::LennaImage>,
) -> Result<(), Box<dyn std::error::Error>> {
self.config = serde_json::from_value(config.config).unwrap();
self.process_exif(&mut image.exif).unwrap();
self.process_image(&mut image.image).unwrap();
Ok(())
}
fn default_config(&self) -> serde_json::Value {
serde_json::to_value(Config::default()).unwrap()
}
}
impl ImageProcessor for Plugin {
fn processimage(
&self,
image: &mut Box
Create a virtual environment for python and install lenna-core using pip.
bash
virtualenv -p python3 .venv
source .venv/bin/activate
pip install .
python src/plugins/python/test.py
python
import lenna_core_py
print(lenna_core_py.Resize.description())
| Rust |
JavaScript |
Python |
C++ |
WASM |
| :---------: | :---------: | :---------: | :---------: | :---------: |
| Yes | Yes | Yes | No | Yes |
This software is licensed under the MIT © lenna-project.