Skip to content

Commit

Permalink
Fixed broken similarity hashing
Browse files Browse the repository at this point in the history
Bumped version to v0.5.11
  • Loading branch information
Futsch1 committed Dec 22, 2022
1 parent f4ce578 commit e610395
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog
All notable changes to this project will be documented in this file.

## [0.5.11] - 2022-12-

### Fixed

- Similarity calculation was broken for some time, fixed it

## [0.5.10] - 2022-12-21

### Fixed
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "image_sieve"
version = "0.5.10"
version = "0.5.11"
authors = ["Florian Fetz <florian.fetz@googlemail.com>"]
description = "GUI based tool to sort out and categorize images, raw images and videos"
repository = "https://github.com/Futsch1/image-sieve"
Expand Down Expand Up @@ -32,6 +32,7 @@ imagepipe = "0.5.0"
dark-light = "0.2"
strum = "0.24"
strum_macros = "0.24"
image-23 = { version = "=0.23", package="image" }

[dev-dependencies]
base64 = "0.13"
Expand Down
6 changes: 3 additions & 3 deletions src/synchronize.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::item_sort_list::ItemList;
use crate::persistence::settings::Settings;
use img_hash::image::GenericImageView;
use image_23::GenericImageView;
use img_hash::HashAlg;
use img_hash::Hasher;
use img_hash::HasherConfig;
Expand Down Expand Up @@ -201,7 +201,7 @@ fn calculate_similar_hashes(item_list: Arc<Mutex<ItemList>>, settings: &Settings
{
let item_list_loc = item_list.lock().unwrap();
for item in &item_list_loc.items {
if item.is_image() && !item.has_hash() {
if (item.is_image() || item.is_raw_image()) && !item.has_hash() {
image_file_names.push(item.path.clone());
}
}
Expand All @@ -210,7 +210,7 @@ fn calculate_similar_hashes(item_list: Arc<Mutex<ItemList>>, settings: &Settings
// Now calculate the hashes
let mut hashes: HashMap<PathBuf, ImageHash<Vec<u8>>> = HashMap::new();
for image_file_name in image_file_names {
if let Ok(image) = img_hash::image::open(&image_file_name) {
if let Ok(image) = image_23::open(&image_file_name) {
// The hash size is dependent on the image orientation to increase the result quality
let (hash_width, hash_height) = if image.width() > image.height() {
(16, 8)
Expand Down

0 comments on commit e610395

Please sign in to comment.