Skip to content

Commit 7617ef5

Browse files
committed
Add changelog, and supporting several UIs with formats [ci] [cd]
1 parent b2bcd1d commit 7617ef5

File tree

14 files changed

+173
-80
lines changed

14 files changed

+173
-80
lines changed

.gitignore

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/.vscode
2-
/target
3-
4-
**/*.ai
5-
/src/assets/colors.png
1+
/.*
2+
!/.github
3+
/target

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
6+
and this project adheres to [Semantic Versioning](http://semver.org/)
7+
8+
## [1.2.0] - 2025-06-23
9+
10+
Adding support for ForgeUI and Automatic1111 with different image formats
11+
12+
### Added
13+
14+
- Support UI - ForgeUI
15+
- Support UI - Automatic1111
16+
- Table of supported UIs and image formats
17+
18+
### Changed
19+
20+
### Fixed
21+
22+
Updates before will be describing here soon...

Cargo.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
2-
name = "sd-extract-output"
3-
version = "1.1.1"
2+
name = "di-extract-output"
3+
version = "1.2.0"
44
edition = "2024"
55
build = "build.rs"
66

@@ -28,9 +28,9 @@ panic = "abort"
2828

2929
[package.metadata.packager]
3030
before-packaging-command = "cargo build --release"
31-
product-name = "SD E/O"
32-
identifier = "com.airfish.sd-extract-output"
31+
product-name = "DI E/O"
32+
identifier = "com.airfish.di-extract-output"
3333
icons = ["icon.png", "icon.ico"]
3434

3535
[package.metadata.winresource]
36-
ProductName = "SD E/O"
36+
ProductName = "DI E/O"

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
1-
# TODO
1+
# DiffusionImage Export/Output
22

3-
- [ ] Write README
3+
## 🧰 TODO
44

5-
Readme soon
5+
- [ ] Update README
6+
- [ ] Add support of ComfyUI
7+
8+
## ✅/❌ Support of UIs and image formats
9+
10+
| UI | PNG | JP(E)G | WebP | AVIF | HEIF | BMP | TIF(F) |
11+
| :------------ | :-: | :----: | :--: | :--: | :--: | :-: | :----: |
12+
| Forge UI ||||||||
13+
| AUTOMATIC1111 ||||||||
14+
| ComfyUI | 🛠️ | 🛠️* | 🛠️* | ✖️* | ✖️* |*|* |
15+
| EasyDiffusion |||| ✖️ | ✖️ | ✖️ | ✖️ |
16+
17+
- ✅ - Supported
18+
- 🛠️ - In development
19+
- ❔ - Not tested
20+
- ❌ - No support
21+
- ➖ - UI don't save params
22+
- ✖️ - UI don't support
23+
24+
\*With using [Save Image Extended for ComfyUI](https://github.com/audioscavenger/save-image-extended-comfyui)

src/core/clipboard.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
use std::{collections::HashMap, path::PathBuf};
22
use copypasta::{ClipboardContext, ClipboardProvider};
33

4-
use crate::core::{civitai::get_by_hash, exif::parse_image, params::Params};
4+
use crate::core::{civitai::get_by_hash, file::check_image, params::Params, parse::{self, raw}};
55

66
pub async fn save_to_clipboard(files: Vec<PathBuf>, civitai_value: bool) -> bool{
77
let mut params: Vec<(PathBuf, Option<Params>)> = files.iter()
8-
.map(|file| match parse_image(&file){
9-
Ok(res) => (file.clone(), Some(res)),
8+
.map(|file| match raw::parse(
9+
check_image(&file).unwrap().extensions_str().get(0).unwrap(),
10+
&file
11+
){
12+
Ok(params) => match parse::extract(params){
13+
Ok(res) => (file.clone(), Some(res)),
14+
Err(_) => (file.clone(), None)
15+
},
1016
Err(_) => (file.clone(), None)
1117
}).collect();
1218

src/core/file.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::path::PathBuf;
22
use freya::{events::FileData, prelude::{Event, Readable, Signal, Writable}};
3-
use image::ImageReader;
3+
use image::{ImageFormat, ImageReader};
44
use walkdir::WalkDir;
55

66
use crate::ui::app::DnDStatus;
@@ -16,15 +16,15 @@ pub fn check_file(files: Signal<Vec<PathBuf>>, file: Event<FileData>) -> DnDStat
1616
.into_iter().filter_map(|e| e.ok()){
1717
let path = entry.path().to_path_buf();
1818
match check_image(&path){
19-
true => {
19+
Some(_) => {
2020
if files.read().contains(&path){
2121
status = DnDStatus::Exists;
2222
} else{
2323
status = DnDStatus::Ok;
2424
break;
2525
}
2626
},
27-
false => continue
27+
None => continue
2828
}
2929
}
3030

@@ -34,25 +34,25 @@ pub fn check_file(files: Signal<Vec<PathBuf>>, file: Event<FileData>) -> DnDStat
3434
return DnDStatus::Exists;
3535
}
3636
match check_image(path){
37-
true => DnDStatus::Ok,
38-
false => DnDStatus::Wrong
37+
Some(_) => DnDStatus::Ok,
38+
None => DnDStatus::Wrong
3939
}
4040
}
4141
}
4242

43-
fn check_image(path: &PathBuf) -> bool{
43+
pub fn check_image(path: &PathBuf) -> Option<ImageFormat>{
4444
return match ImageReader::open(path){
4545
Ok(img) => match img.with_guessed_format(){
4646
Ok(img) => {
4747
if img.format().is_none(){
48-
false
48+
None
4949
} else {
50-
true
50+
Some(img.format().unwrap())
5151
}
5252
},
53-
Err(_) => false
53+
Err(_) => None
5454
},
55-
Err(_) => false
55+
Err(_) => None
5656
}
5757
}
5858

@@ -76,12 +76,12 @@ pub fn write(
7676
.into_iter().filter_map(|e| e.ok()){
7777
let path = entry.path().to_path_buf();
7878
match check_image(&path){
79-
true => {
79+
Some(_) => {
8080
if !files.read().contains(&path){
8181
files.write().push(path.clone());
8282
}
8383
},
84-
false => continue
84+
None => continue
8585
}
8686
}
8787
} else{

src/core/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pub mod config;
22

33
pub mod file;
4-
pub mod exif;
4+
pub mod parse;
55
pub mod params;
66

77
pub mod civitai;

src/core/exif.rs renamed to src/core/parse/mod.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1-
use std::path::PathBuf;
2-
use std::fs;
3-
41
use crate::core::{civitai::get_all, params::Params};
52

6-
pub fn parse_image(path: &PathBuf) -> Result<Params, String>{
7-
let mut res = Params::default();
8-
let file = fs::read(path).map_err(|e| format!("Ошибка чтения файла: {e}"))?;
3+
pub mod raw;
94

10-
let file_str = String::from_utf8_lossy(&file);
11-
let raw_params = file_str.split("parameters").nth(1)
12-
.ok_or(format!("Не удалось найти данные"))?;
13-
let raw_params = raw_params.split("IDAT").nth(0)
14-
.ok_or(format!("Не удалось найти данные"))?;
15-
let params = String::from_utf8(clean_text_bytes(raw_params.as_bytes()))
16-
.map_err(|e| format!("Ошибка чистки байтов: {e}"))?;
17-
5+
pub fn extract(params: String) -> Result<Params, String>{
6+
let mut res = Params::default();
187
// Get prompts
198
let params_clone = params.clone();
209
let prompts_split = params_clone.split("Steps:").nth(0)

src/core/parse/raw.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
use std::{fs, path::PathBuf};
2+
3+
use crate::core::parse::clean_text_bytes;
4+
5+
pub fn parse(format: &str, path: &PathBuf) -> Result<String, String>{
6+
let split = match format{
7+
"jpg" | "jpeg" => ("UNICODE", ""),
8+
"avif" => ("UNICODE", ""),
9+
"png" => ("parameters", "IDAT"),
10+
_ => ("UNICODE", "NO SECOND SPLIT CHARACTER !#@")
11+
};
12+
13+
let file = fs::read(path).map_err(|e| format!("Ошибка чтения файла: {e}"))?;
14+
15+
let file_str = String::from_utf8_lossy(&file);
16+
let raw_params = file_str.split(split.0).nth(1)
17+
.ok_or(format!("Не удалось найти данные"))?;
18+
let raw_params = raw_params.split(split.1).nth(0)
19+
.ok_or(format!("Не удалось найти данные"))?;
20+
let params = String::from_utf8(clean_text_bytes(raw_params.as_bytes()))
21+
.map_err(|e| format!("Ошибка чистки байтов: {e}"))?;
22+
23+
Ok(params)
24+
}

0 commit comments

Comments
 (0)