{"id":13528211,"url":"https://github.com/kornelski/dssim","last_synced_at":"2025-05-13T17:09:21.578Z","repository":{"id":1096799,"uuid":"1388070","full_name":"kornelski/dssim","owner":"kornelski","description":"Image similarity comparison simulating human perception (multiscale SSIM in Rust)","archived":false,"fork":false,"pushed_at":"2025-05-02T16:22:29.000Z","size":1021,"stargazers_count":1122,"open_issues_count":7,"forks_count":72,"subscribers_count":22,"default_branch":"main","last_synced_at":"2025-05-02T17:27:29.683Z","etag":null,"topics":["c","comparison","compress-images","dssim","image-benchmark","libpng","similarity","similarity-measurement","ssim"],"latest_commit_sha":null,"homepage":"https://kornel.ski/dssim","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kornelski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2011-02-20T01:41:41.000Z","updated_at":"2025-05-02T16:22:32.000Z","dependencies_parsed_at":"2024-01-24T01:27:09.994Z","dependency_job_id":"d6733a77-61b2-477f-976b-a666d7991f0f","html_url":"https://github.com/kornelski/dssim","commit_stats":{"total_commits":122,"total_committers":11,"mean_commits":"11.090909090909092","dds":0.180327868852459,"last_synced_commit":"cdb66dbc794326341b4bf12857d4c22b67f09c04"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kornelski%2Fdssim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kornelski%2Fdssim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kornelski%2Fdssim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kornelski%2Fdssim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kornelski","download_url":"https://codeload.github.com/kornelski/dssim/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253990468,"owners_count":21995774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","comparison","compress-images","dssim","image-benchmark","libpng","similarity","similarity-measurement","ssim"],"created_at":"2024-08-01T06:02:19.115Z","updated_at":"2025-05-13T17:09:16.566Z","avatar_url":"https://github.com/kornelski.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# RGBA Structural Similarity\n\nThis tool computes (dis)similarity between two or more PNG \u0026/or JPEG images using an algorithm approximating human vision. Comparison is done using a variant of [the SSIM algorithm](https://ece.uwaterloo.ca/~z70wang/research/ssim/).\n\nThe value returned is 1/SSIM-1, where 0 means identical image, and \u003e0 (unbounded) is amount of difference. Values are not directly comparable with other tools. [See below](#interpreting-the-values) on interpreting the values.\n\n## Features\n\n* Improved algorithm\n    * Compares at multiple weighed resolutions, and scaling is done in linear-light RGB. It's sensitive to distortions of various sizes and blends colors correctly to detect e.g. chroma subsampling errors.\n    * Uses L\\*a\\*b\\* color space for the SSIM algorithm. It measures brightness and color much better than metrics from average of RGB channels.\n* Supports alpha channel.\n* Supports images with color profiles.\n* Takes advantage of multi-core CPUs.\n* Can be used as a library in C, Rust, and WASM.\n* No OpenCV or MATLAB needed.\n\n## Usage\n\n    dssim file-original.png file-modified.png\n\nWill output something like \"0.02341\" (smaller is better) followed by a filename.\n\nYou can supply multiple filenames to compare them all with the first file:\n\n    dssim file.png modified1.png modified2.png modified3.png\n\nYou can save an image visualising the difference between the files:\n\n    dssim -o difference.png file.png file-modified.png\n\nIt's also usable [as a library](https://docs.rs/dssim).\n\nPlease be mindful about color profiles in the images. Different profiles, or lack of support for profiles in other tools, can make images appear different even when the pixels are the same.\n\n### Interpreting the values\n\nThe amount of difference goes from 0 to infinity. It's not a percentage.\n\nIf you're comparing two different image compression codecs, then ensure you either:\n\n* compress images to the same file size, and then use DSSIM to compare which one is closests to the original, or\n* compress images to the same DSSIM value, and compare file sizes to see how much file size gain each option gives.\n\n[More about benchmarking image compression](https://kornel.ski/faircomparison).\n\nWhen you quote results, please include the DSSIM version. The scale has changed between versions.\nThe version is printed when you run `dssim -h`.\n\n## Download\n\n[Download from releases page](https://github.com/kornelski/dssim/releases). It's also available in Mac Homebrew and Ubuntu Snaps.\n\n### Build from source\n\nYou'll need [Rust 1.63](https://rustup.rs) or later. Clone the repo and run:\n\n    rustup update\n    cargo build --release\n\nWill give you `./target/release/dssim`.\n\n## Accuracy\n\nScores for version 3.2 [measured][2] against [TID2013][1] database:\n\nTID2013  | Spearman | Kendall\n---------|----------|--------\nNoise    |  -0.9392 | -0.7789\nActual   |  -0.9448 | -0.7913\nSimple   |  -0.9499 | -0.8082\nExotic   |  -0.8436 | -0.6574\nNew      |  -0.8717 | -0.6963\nColor    |  -0.8789 | -0.7032\nFull     |  -0.8711 | -0.6984\n\n[1]: http://www.ponomarenko.info/tid2013.htm\n[2]: https://lib.rs/crates/tid2013stats\n\n## Usage from C\n\nMake sure to build `dssim-core` library project, not the parent `dssim` binary project.\n\n```bash\ncd dssim-core\nrustup update\ncargo build --release\n```\n\nThis will build `target/release/libdssim_core.a` that you can link with your project. Use `dssim.h` included in the dssim repo. It's up to you where you put these files.\n\nAlternatively, on Linux there is a more involved but slightly more proper method:\n\n```bash\ncargo install cargo-c\ncargo cinstall --release --destdir=/ --prefix=/usr/lib\n```\n\nThis will install `libdssim.so` in `/usr/lib` and make `dssim` available to `pkg-config`. See `target/\u003cplatform\u003e/release` for all the files built this way.\n\n## License\n\nDSSIM is dual-licensed under [AGPL](LICENSE) or [commercial](https://supso.org/projects/dssim) license.\n\n## The algorithm improvements in DSSIM\n\n* The comparison is done on multiple weighed scales (based on IWSSIM) to measure features of different sizes. A single-scale SSIM is biased towards differences smaller than its gaussian kernel.\n* Scaling is done in linear-light RGB to model physical effects of viewing distance/lenses. Scaling in sRGB or Lab would have incorrect gamma and mask distortions caused by chroma subsampling.\n* a/b channels of Lab are compared with lower spatial precision to simulate eyes' higher sensitivity to brightness than color changes.\n* SSIM score is pooled using mean absolute deviation. You can get per-pixel SSIM from the API to implement custom pooling.\n\n## Compiling for WASM\n\nFor compatibility with single-threaded WASM runtimes, disable the `threads` Cargo feature. It's enabled by default, so to disable it, disable default features:\n\n```toml\ndssim-core = { version = \"3.2\", default-features = false }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkornelski%2Fdssim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkornelski%2Fdssim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkornelski%2Fdssim/lists"}