Skip to content

Commit

Permalink
refactor: iterate block-wise and store the bounds to avoid duplicate …
Browse files Browse the repository at this point in the history
…effort (removes redundant second pass)
  • Loading branch information
krish-r committed Jul 8, 2023
1 parent 506de6d commit 71ad4a6
Show file tree
Hide file tree
Showing 5 changed files with 165 additions and 97 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "idiff"
version = "0.1.0"
version = "0.2.0"
edition = "2021"
description = "diff - for images (compares images pixel by pixel)"

Expand Down
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ diff - for images (compares images pixel by pixel)

## Approach

This takes a naive two pass approach -

- first pass - compare every pixel between the images and check for differences, and display the comparison status.
- second pass - (if the `highlight` option is enabled)
- compare every pixel in each block (default: `10x10` pixels) and check for differences, and if there is any, highlight the block.
- store the output with the file name specified in the `output` option (default `TARGET_FILE_NAME_diff`).
- Compare every pixel between the images for every block and check for differences, and display the comparison status.
- if the `highlight` option is enabled, highlight the blocks with difference and store the output with the file name specified in the `output` option (default `TARGET_FILE_NAME_diff`).

## Dependencies

Expand Down Expand Up @@ -59,10 +55,10 @@ cargo install --path .

```sh
# Download the binary from release page
curl -LO https://github.com/krish-r/idiff/releases/download/0.1.0/idiff_0.1.0.tar.gz
curl -LO https://github.com/krish-r/idiff/releases/download/0.2.0/idiff_0.2.0.tar.gz

# Extract the archive
tar xvzf ./idiff_0.1.0.tar.gz && rm -ir ./idiff_0.1.0.tar.gz
tar xvzf ./idiff_0.2.0.tar.gz && rm -ir ./idiff_0.2.0.tar.gz

# add executable permission to user
chmod u+x ./idiff
Expand Down
6 changes: 6 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ clean:
check:
cargo check

check-tests:
cargo check --tests

clippy:
cargo clippy

clippy-tests:
cargo clippy --tests

build:
cargo build

Expand Down
Loading

0 comments on commit 71ad4a6

Please sign in to comment.