encrypted-images/examples/decode_image.rs

12 lines
19 KiB
Rust
Raw Normal View History

2024-07-16 23:40:41 +00:00
use encrypted_images::decryption::images::decode_image_and_extract_text;
fn main() {
let encoded_image = "iVBORw0KGgoAAAANSUhEUgAAAGwAAABsCAYAAACPZlfNAAA3rklEQVR4nO3deWxcW34n9u9dat+ryFpY3JeiJGqhpLfoLXS3uttre2L3xJPxuB0HjoNkepAgHiQzCBIgSJwAGTjOJJ5BkHiWbJ7ECyaDAJN0HMNu9/L6vX79+kmiRFEiRZHFnSyyWFVk7XWrbr7n3kOyROm9fpjpf9jgARqtEsmqOudz7zm/haqnBAffNT0791Bqt+DpuYFSyo2ku4bmsg70FgBzGb7CHezmPoQjM4Kx517kMh24Fx9j72YAsUeDyI0r6Dyeh3PYiajnFvaDDxF8cITmyDiqmgdOVYFurMLwDqL9YB7m7V4E9DhaB1U0nq0AYyOIu3cAbxnlfAwlNYmwaw3G5iX09jqwGK0i0VJgrurojD9EalbF83oT3jf5+L2rqCWz8IWAWovfV7+K7aGniK1cw+7ABzAdExBDM57Dlb2B1ugWQo0+1NseNHJP4U31o7q9wb+PQTOXoO/2w3cURiVQRDO2Dn9ZQb0QQaCdxm6fHwllB2XnPlqOHiSLKeR8B/BWttCshaDGQmgq86g33oTb+z2ohhNeZRp5Zx3hj+egD4asuV1a0rAe0BB161jn2l/yOfl6V9Eq1LBqLCEZu4Zm04CSmEXKOYAV5y4C2QwOJupQAgPvmL7cPRRaLfgIVngJLItA4Q1sS7AJgu0QzLv0BLs3fOgl2M4JmBs9nmnkCBYmWH3kFWAPn8K8GUOIYA0B9nwVGBniawqwKg7zEWtSx2AJgj3tAsP4HFKPVDwjmP91HcZ7V7rA6kjVr2CTYL0E234BbAWe7DU0PhVsGc7dPngIViNY3QLTCBY6AUsR7FCC9RFsx2eDGQSDBfaUYK8T7PsE018JdoVgqwTrIdgqwa4E3Kj4rthgnSXEI8dgj5B2pvG8G8zf/7YZ2L+HfKOFAMHyL4GtIVR4DZsSbJ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Vo2WHh8A6l1FR8RrH9Cx/5cH2ruYzA3Ltf78JhgExbYI04wRS5OwygglR3A7ieAmQQzeXHGd71oEMxlgRXgtcBMC6wmwdYI1pZgTyWYvxbimSfAduBsTKDpXSRY2QJrEEz/eJFgHmtud9Y0zLo07ioEK8/bYK0+GyzIC185BlvHlNOHjyXY4QTB9J5b5oAhwBzMqicsMPcLYIcYKowz7+Hkkwm8uenF/GAH/Qe7eDLQwCTB5gmmrmehRsPIeAhIsNEHGrZGel4G28jBHFIwQrBtAVY4AkIBXLHA3MjmTVTUJPdxG+yyBPO0bLDo+BZSmyo+JNjgmI7cfJJX8DGYF1P1JB4RbNICe0ywBLmAtlFCOpvG9ieAKQRr8+JM7rpRI5jHAivBbYG1LbCGBMsSzJRg8xIsSLADCywHd2MMdW5tqnFogbUIpn7MKsqgy5rbnQ0N9x0adxWCVZ/aYI2kDRbm95nHYJu45vTgIwlWniCYFrtpDnUe2GD6mAXmfAGsjJHCKBaaj2HGe/HWthdz/R3mIHt4nK7h8mOCjRJsk4dtOIxLnn7ME2z8oQMbQ1HUCaarXWBbnOyAiTGCbQqwUgUI+HDVAmNAk2+jpibhlWBTEszVssF6xneQ2lbxAcGGR3TsPGUCrh+D+XGtHsfs0FNcXhFgTwjWSy4BdkSwFDY/AUyzwA4JxjIRwXwW2BGcFhiLCgRrSbBl5z6f9xTMTbAwwfYJZij7BBsh2DJggV1Hm2C4zx2o32HN7c6Who81jbsKweqLNliNpbqSAFuG2p6SYNu44XThQ+cewcZRnSCYGp02R/DQBlN5KBNMfwGsirHCMBaMJ2j3xPAOt4yHfR0MH+bxKFXB1BOCDROMk+4Ew7ji6cMcwTJzLqwNhNEkmNoNtnMAM93GBMHWBdhRDfB5cN0C82Mp30JDTcItwa5JMEfLBouP55DaVfFdgo0O6dha7OEiZC
if let Some(extracted_text) = decode_image_and_extract_text(encoded_image) {
println!("Extracted text: {}", extracted_text);
} else {
println!("Image decoding or text extraction failed.");
}
}