Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
SalOne22 committed Dec 18, 2023
1 parent c0314a2 commit 134fafc
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,8 @@ Alternatively you can build rimage from source if you have `rust`, `cargo`, `nas
cargo install rimage
```

## Note

1. Jxl(JpegXL) format on Microsoft Windows® is not support, because of its complexity.

2. If you met the error of **"Could not find libstdc++-6.dll", etc.**, please download all 3 DLLs from **[HERE](https://github.com/Mikachu2333/rimage_gui/releases/tag/0.0.0.0)** and put these 3 DLLs near Rimage.

3. If you're a user who just want to **use Rimage easily with a friendly GUI**, [Rimage_gui](https://github.com/Mikachu2333/rimage_gui/releases/) may be fit for you, it support both Chinese and English. Just select the version you need and download it to use.
### Note:
If you're a user who just want to **use Rimage easily with a friendly GUI**, [Rimage_gui](https://github.com/Mikachu2333/rimage_gui/releases/) may be fit for you, it support both Chinese and English. Just select the version you need and download it to use.

## Usage

Expand Down Expand Up @@ -152,29 +147,30 @@ rimage = "0.10.0"
```rs
use rimage::Decoder;

let path = std::path::PathBuf::from(/* Your path */);

let decoder = Decoder::from_path(&path)?;
let decoder = Decoder::from_path("image.jpg")?;

let image = decoder.decode()?;

// Handle the image...
// do something with the image data...
```

### Encoding

```rs
use rimage::{rgb::RGBA8, Encoder, Image, config::{EncoderConfig, Codec}};
use std::fs::File;

use rimage::{rgb::RGBA8, Encoder, config::{EncoderConfig, Codec}};
use image::{RgbaImage, DynamicImage};

let image_data = vec![RGBA8::new(0, 0, 0, 0); 100 * 50];
let image = Image::new(image_data, 100, 50);
let image_data = vec![0; 100 * 50 * 4];
let image = RgbaImage::from_raw(100, 50, image_data)?;

let config = EncoderConfig::new(Codec::MozJpeg).with_quality(80.0).unwrap();
let file = std::fs::File::create("output.jpg").expect("Failed to create file");
let config = EncoderConfig::new(Codec::MozJpeg).with_quality(80.0)?;
let file = File::create("output.jpg")?;

let encoder = Encoder::new(file, image).with_config(config);
let encoder = Encoder::new(file, DynamicImage::ImageRgba8(image)).with_config(config);

encoder.encode()?; // Writes image data to the file.
encoder.encode()?;
```

> For full API documentation, visit [docs.rs](https://docs.rs/rimage) page.
Expand Down

0 comments on commit 134fafc

Please sign in to comment.