Is there some tool to create fingerprint images like on acoustid.org, to compare submitted fingerprints to local files?
4 Likes
For reference, the code that creates the images on the website is renderFingerprintData here:
1 Like
Wrote a little Rust program to turn the output of fpcalc into an image that matches those on AcoustID.org (works for me on Linux).
src/main.rs:
use std::env;
use std::process::Command;
fn main() {
let args: Vec<String> = env::args().collect();
let file = &args[1];
let output = Command::new("/usr/bin/fpcalc")
.arg("-raw")
.arg(file)
.output()
.expect("error running fpcalc");
let stdout = String::from_utf8_lossy(&output.stdout);
let mut lines = stdout.lines();
lines.next();
let fpstring = lines.next().unwrap();
let mut fpstring2 = fpstring.split('=');
fpstring2.next();
let fpstring3 = fpstring2.next().unwrap().split(',');
let fpstring4 = fpstring3.clone();
let yy:u32 = fpstring3.count().try_into().unwrap();
let mut img = image::RgbImage::new(32, yy);
let mut y:u32 = 0;
for line in fpstring4 {
let b = line.parse::<u32>().unwrap();
for x in 0..32 {
let p = (b >> x) & 1;
let pp = 255 * p;
img.put_pixel(x, y, image::Rgb([pp.try_into().unwrap(), pp.try_into().unwrap(), pp.try_into().unwrap()]));
}
y += 1;
}
let outf = file.to_owned() + ".png";
img.save(outf).unwrap();
}
Cargo.toml:
[package]
name = "aid"
version = "0.1.0"
edition = "2024"
[dependencies]
image = "0.25.6"
4 Likes