├── .gitignore ├── .travis.yml ├── Cargo.lock ├── Cargo.toml ├── README.md ├── img ├── eog_screen.png └── tool_screen.png └── src └── main.rs /.gitignore: -------------------------------------------------------------------------------- 1 | Cargo.lock 2 | target 3 | core* 4 | .idea 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: rust 2 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | [root] 2 | name = "cleye" 3 | version = "0.1.0" 4 | dependencies = [ 5 | "error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", 6 | "image 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", 7 | "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 8 | "loggerv 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 9 | "structopt 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 10 | "structopt-derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 11 | "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 12 | ] 13 | 14 | [[package]] 15 | name = "adler32" 16 | version = "1.0.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | 19 | [[package]] 20 | name = "ansi_term" 21 | version = "0.7.5" 22 | source = "registry+https://github.com/rust-lang/crates.io-index" 23 | 24 | [[package]] 25 | name = "ansi_term" 26 | version = "0.9.0" 27 | source = "registry+https://github.com/rust-lang/crates.io-index" 28 | 29 | [[package]] 30 | name = "atty" 31 | version = "0.2.2" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | dependencies = [ 34 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 35 | "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", 36 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 37 | ] 38 | 39 | [[package]] 40 | name = "backtrace" 41 | version = "0.3.3" 42 | source = "registry+https://github.com/rust-lang/crates.io-index" 43 | dependencies = [ 44 | "backtrace-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 45 | "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 46 | "dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 47 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 48 | "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", 49 | "rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 50 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 51 | ] 52 | 53 | [[package]] 54 | name = "backtrace-sys" 55 | version = "0.1.12" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | dependencies = [ 58 | "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", 59 | "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", 60 | ] 61 | 62 | [[package]] 63 | name = "bitflags" 64 | version = "0.7.0" 65 | source = "registry+https://github.com/rust-lang/crates.io-index" 66 | 67 | [[package]] 68 | name = "bitflags" 69 | version = "0.9.1" 70 | source = "registry+https://github.com/rust-lang/crates.io-index" 71 | 72 | [[package]] 73 | name = "byteorder" 74 | version = "1.1.0" 75 | source = "registry+https://github.com/rust-lang/crates.io-index" 76 | 77 | [[package]] 78 | name = "cfg-if" 79 | version = "0.1.2" 80 | source = "registry+https://github.com/rust-lang/crates.io-index" 81 | 82 | [[package]] 83 | name = "clap" 84 | version = "2.26.0" 85 | source = "registry+https://github.com/rust-lang/crates.io-index" 86 | dependencies = [ 87 | "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 88 | "atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 89 | "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", 90 | "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", 91 | "term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 92 | "textwrap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 93 | "unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 94 | "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 95 | "vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 96 | ] 97 | 98 | [[package]] 99 | name = "coco" 100 | version = "0.1.1" 101 | source = "registry+https://github.com/rust-lang/crates.io-index" 102 | dependencies = [ 103 | "either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 104 | "scopeguard 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", 105 | ] 106 | 107 | [[package]] 108 | name = "color_quant" 109 | version = "1.0.0" 110 | source = "registry+https://github.com/rust-lang/crates.io-index" 111 | 112 | [[package]] 113 | name = "conv" 114 | version = "0.3.3" 115 | source = "registry+https://github.com/rust-lang/crates.io-index" 116 | dependencies = [ 117 | "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 118 | ] 119 | 120 | [[package]] 121 | name = "custom_derive" 122 | version = "0.1.7" 123 | source = "registry+https://github.com/rust-lang/crates.io-index" 124 | 125 | [[package]] 126 | name = "dbghelp-sys" 127 | version = "0.2.0" 128 | source = "registry+https://github.com/rust-lang/crates.io-index" 129 | dependencies = [ 130 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 131 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 132 | ] 133 | 134 | [[package]] 135 | name = "deflate" 136 | version = "0.7.16" 137 | source = "registry+https://github.com/rust-lang/crates.io-index" 138 | dependencies = [ 139 | "adler32 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 140 | "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 141 | ] 142 | 143 | [[package]] 144 | name = "either" 145 | version = "1.1.0" 146 | source = "registry+https://github.com/rust-lang/crates.io-index" 147 | 148 | [[package]] 149 | name = "enum_primitive" 150 | version = "0.1.1" 151 | source = "registry+https://github.com/rust-lang/crates.io-index" 152 | dependencies = [ 153 | "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", 154 | ] 155 | 156 | [[package]] 157 | name = "error-chain" 158 | version = "0.10.0" 159 | source = "registry+https://github.com/rust-lang/crates.io-index" 160 | dependencies = [ 161 | "backtrace 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 162 | ] 163 | 164 | [[package]] 165 | name = "futures" 166 | version = "0.1.15" 167 | source = "registry+https://github.com/rust-lang/crates.io-index" 168 | 169 | [[package]] 170 | name = "gcc" 171 | version = "0.3.53" 172 | source = "registry+https://github.com/rust-lang/crates.io-index" 173 | 174 | [[package]] 175 | name = "gif" 176 | version = "0.9.2" 177 | source = "registry+https://github.com/rust-lang/crates.io-index" 178 | dependencies = [ 179 | "color_quant 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 180 | "lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", 181 | ] 182 | 183 | [[package]] 184 | name = "image" 185 | version = "0.15.0" 186 | source = "registry+https://github.com/rust-lang/crates.io-index" 187 | dependencies = [ 188 | "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 189 | "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 190 | "gif 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", 191 | "jpeg-decoder 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", 192 | "num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", 193 | "num-rational 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", 194 | "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", 195 | "png 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 196 | "scoped_threadpool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 197 | ] 198 | 199 | [[package]] 200 | name = "inflate" 201 | version = "0.2.0" 202 | source = "registry+https://github.com/rust-lang/crates.io-index" 203 | 204 | [[package]] 205 | name = "jpeg-decoder" 206 | version = "0.1.13" 207 | source = "registry+https://github.com/rust-lang/crates.io-index" 208 | dependencies = [ 209 | "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 210 | "rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", 211 | ] 212 | 213 | [[package]] 214 | name = "kernel32-sys" 215 | version = "0.2.2" 216 | source = "registry+https://github.com/rust-lang/crates.io-index" 217 | dependencies = [ 218 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 219 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 220 | ] 221 | 222 | [[package]] 223 | name = "lazy_static" 224 | version = "0.2.8" 225 | source = "registry+https://github.com/rust-lang/crates.io-index" 226 | 227 | [[package]] 228 | name = "libc" 229 | version = "0.2.30" 230 | source = "registry+https://github.com/rust-lang/crates.io-index" 231 | 232 | [[package]] 233 | name = "log" 234 | version = "0.3.8" 235 | source = "registry+https://github.com/rust-lang/crates.io-index" 236 | 237 | [[package]] 238 | name = "loggerv" 239 | version = "0.2.0" 240 | source = "registry+https://github.com/rust-lang/crates.io-index" 241 | dependencies = [ 242 | "ansi_term 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", 243 | "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 244 | ] 245 | 246 | [[package]] 247 | name = "lzw" 248 | version = "0.10.0" 249 | source = "registry+https://github.com/rust-lang/crates.io-index" 250 | 251 | [[package]] 252 | name = "magenta" 253 | version = "0.1.1" 254 | source = "registry+https://github.com/rust-lang/crates.io-index" 255 | dependencies = [ 256 | "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 257 | "magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 258 | ] 259 | 260 | [[package]] 261 | name = "magenta-sys" 262 | version = "0.1.1" 263 | source = "registry+https://github.com/rust-lang/crates.io-index" 264 | dependencies = [ 265 | "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 266 | ] 267 | 268 | [[package]] 269 | name = "num-integer" 270 | version = "0.1.35" 271 | source = "registry+https://github.com/rust-lang/crates.io-index" 272 | dependencies = [ 273 | "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", 274 | ] 275 | 276 | [[package]] 277 | name = "num-iter" 278 | version = "0.1.34" 279 | source = "registry+https://github.com/rust-lang/crates.io-index" 280 | dependencies = [ 281 | "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", 282 | "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", 283 | ] 284 | 285 | [[package]] 286 | name = "num-rational" 287 | version = "0.1.39" 288 | source = "registry+https://github.com/rust-lang/crates.io-index" 289 | dependencies = [ 290 | "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", 291 | "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", 292 | ] 293 | 294 | [[package]] 295 | name = "num-traits" 296 | version = "0.1.40" 297 | source = "registry+https://github.com/rust-lang/crates.io-index" 298 | 299 | [[package]] 300 | name = "num_cpus" 301 | version = "1.6.2" 302 | source = "registry+https://github.com/rust-lang/crates.io-index" 303 | dependencies = [ 304 | "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", 305 | ] 306 | 307 | [[package]] 308 | name = "png" 309 | version = "0.9.0" 310 | source = "registry+https://github.com/rust-lang/crates.io-index" 311 | dependencies = [ 312 | "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", 313 | "deflate 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)", 314 | "inflate 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 315 | "num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", 316 | ] 317 | 318 | [[package]] 319 | name = "quote" 320 | version = "0.3.15" 321 | source = "registry+https://github.com/rust-lang/crates.io-index" 322 | 323 | [[package]] 324 | name = "rand" 325 | version = "0.3.16" 326 | source = "registry+https://github.com/rust-lang/crates.io-index" 327 | dependencies = [ 328 | "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", 329 | "magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 330 | ] 331 | 332 | [[package]] 333 | name = "rayon" 334 | version = "0.8.2" 335 | source = "registry+https://github.com/rust-lang/crates.io-index" 336 | dependencies = [ 337 | "rayon-core 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 338 | ] 339 | 340 | [[package]] 341 | name = "rayon-core" 342 | version = "1.2.1" 343 | source = "registry+https://github.com/rust-lang/crates.io-index" 344 | dependencies = [ 345 | "coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 346 | "futures 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", 347 | "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 348 | "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", 349 | "num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)", 350 | "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", 351 | ] 352 | 353 | [[package]] 354 | name = "redox_syscall" 355 | version = "0.1.31" 356 | source = "registry+https://github.com/rust-lang/crates.io-index" 357 | 358 | [[package]] 359 | name = "redox_termios" 360 | version = "0.1.1" 361 | source = "registry+https://github.com/rust-lang/crates.io-index" 362 | dependencies = [ 363 | "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", 364 | ] 365 | 366 | [[package]] 367 | name = "rustc-demangle" 368 | version = "0.1.5" 369 | source = "registry+https://github.com/rust-lang/crates.io-index" 370 | 371 | [[package]] 372 | name = "scoped_threadpool" 373 | version = "0.1.7" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | 376 | [[package]] 377 | name = "scopeguard" 378 | version = "0.3.2" 379 | source = "registry+https://github.com/rust-lang/crates.io-index" 380 | 381 | [[package]] 382 | name = "strsim" 383 | version = "0.6.0" 384 | source = "registry+https://github.com/rust-lang/crates.io-index" 385 | 386 | [[package]] 387 | name = "structopt" 388 | version = "0.1.0" 389 | source = "registry+https://github.com/rust-lang/crates.io-index" 390 | dependencies = [ 391 | "clap 2.26.0 (registry+https://github.com/rust-lang/crates.io-index)", 392 | ] 393 | 394 | [[package]] 395 | name = "structopt-derive" 396 | version = "0.1.0" 397 | source = "registry+https://github.com/rust-lang/crates.io-index" 398 | dependencies = [ 399 | "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", 400 | "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", 401 | ] 402 | 403 | [[package]] 404 | name = "syn" 405 | version = "0.11.11" 406 | source = "registry+https://github.com/rust-lang/crates.io-index" 407 | dependencies = [ 408 | "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", 409 | "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", 410 | "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 411 | ] 412 | 413 | [[package]] 414 | name = "synom" 415 | version = "0.11.3" 416 | source = "registry+https://github.com/rust-lang/crates.io-index" 417 | dependencies = [ 418 | "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 419 | ] 420 | 421 | [[package]] 422 | name = "term_size" 423 | version = "0.3.0" 424 | source = "registry+https://github.com/rust-lang/crates.io-index" 425 | dependencies = [ 426 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 427 | "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", 428 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 429 | ] 430 | 431 | [[package]] 432 | name = "termion" 433 | version = "1.5.1" 434 | source = "registry+https://github.com/rust-lang/crates.io-index" 435 | dependencies = [ 436 | "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", 437 | "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", 438 | "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 439 | ] 440 | 441 | [[package]] 442 | name = "textwrap" 443 | version = "0.7.0" 444 | source = "registry+https://github.com/rust-lang/crates.io-index" 445 | dependencies = [ 446 | "term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 447 | "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 448 | ] 449 | 450 | [[package]] 451 | name = "unicode-segmentation" 452 | version = "1.2.0" 453 | source = "registry+https://github.com/rust-lang/crates.io-index" 454 | 455 | [[package]] 456 | name = "unicode-width" 457 | version = "0.1.4" 458 | source = "registry+https://github.com/rust-lang/crates.io-index" 459 | 460 | [[package]] 461 | name = "unicode-xid" 462 | version = "0.0.4" 463 | source = "registry+https://github.com/rust-lang/crates.io-index" 464 | 465 | [[package]] 466 | name = "vec_map" 467 | version = "0.8.0" 468 | source = "registry+https://github.com/rust-lang/crates.io-index" 469 | 470 | [[package]] 471 | name = "winapi" 472 | version = "0.2.8" 473 | source = "registry+https://github.com/rust-lang/crates.io-index" 474 | 475 | [[package]] 476 | name = "winapi-build" 477 | version = "0.1.1" 478 | source = "registry+https://github.com/rust-lang/crates.io-index" 479 | 480 | [metadata] 481 | "checksum adler32 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6cbd0b9af8587c72beadc9f72d35b9fbb070982c9e6203e46e93f10df25f8f45" 482 | "checksum ansi_term 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "30275ad0ad84ec1c06dde3b3f7d23c6006b7d76d61a85e7060b426b747eff70d" 483 | "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" 484 | "checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159" 485 | "checksum backtrace 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "99f2ce94e22b8e664d95c57fff45b98a966c2252b60691d0b7aeeccd88d70983" 486 | "checksum backtrace-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "afccc5772ba333abccdf60d55200fa3406f8c59dcf54d5f7998c9107d3799c7c" 487 | "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" 488 | "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" 489 | "checksum byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d" 490 | "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" 491 | "checksum clap 2.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2267a8fdd4dce6956ba6649e130f62fb279026e5e84b92aa939ac8f85ce3f9f0" 492 | "checksum coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c06169f5beb7e31c7c67ebf5540b8b472d23e3eade3b2ec7d1f5b504a85f91bd" 493 | "checksum color_quant 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a475fc4af42d83d28adf72968d9bcfaf035a1a9381642d8e85d8a04957767b0d" 494 | "checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" 495 | "checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" 496 | "checksum dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97590ba53bcb8ac28279161ca943a924d1fd4a8fb3fa63302591647c4fc5b850" 497 | "checksum deflate 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)" = "c4b2a7e3365fa1e8afd32147b543adaa3390f0115e8af5884abc2f854052792b" 498 | "checksum either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18785c1ba806c258137c937e44ada9ee7e69a37e3c72077542cd2f069d78562a" 499 | "checksum enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4551092f4d519593039259a9ed8daedf0da12e5109c5280338073eaeb81180" 500 | "checksum error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9435d864e017c3c6afeac1654189b06cdb491cf2ff73dbf0d73b0f292f42ff8" 501 | "checksum futures 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a82bdc62350ca9d7974c760e9665102fc9d740992a528c2254aa930e53b783c4" 502 | "checksum gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)" = "e8310f7e9c890398b0e80e301c4f474e9918d2b27fca8f48486ca775fa9ffc5a" 503 | "checksum gif 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2e41945ba23db3bf51b24756d73d81acb4f28d85c3dccc32c6fae904438c25f" 504 | "checksum image 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "634700d4a51fa91ceaa798001d46bf862c7b712bd691085d7ba6afd5521e21f7" 505 | "checksum inflate 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d1238524675af3938a7c74980899535854b88ba07907bb1c944abe5b8fc437e5" 506 | "checksum jpeg-decoder 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2805ccb10ffe4d10e06ef68a158ff94c255211ecbae848fbde2146b098f93ce7" 507 | "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" 508 | "checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" 509 | "checksum libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)" = "2370ca07ec338939e356443dac2296f581453c35fe1e3a3ed06023c49435f915" 510 | "checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" 511 | "checksum loggerv 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c11c571d00efad8a8a0eac23cfe50eb5ea83d4df470f3d74dc41d944dc643b4d" 512 | "checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" 513 | "checksum magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf0336886480e671965f794bc9b6fce88503563013d1bfb7a502c81fe3ac527" 514 | "checksum magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40d014c7011ac470ae28e2f76a02bfea4a8480f73e701353b49ad7a8d75f4699" 515 | "checksum num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "d1452e8b06e448a07f0e6ebb0bb1d92b8890eea63288c0b627331d53514d0fba" 516 | "checksum num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "7485fcc84f85b4ecd0ea527b14189281cf27d60e583ae65ebc9c088b13dffe01" 517 | "checksum num-rational 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "288629c76fac4b33556f4b7ab57ba21ae202da65ba8b77466e6d598e31990790" 518 | "checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0" 519 | "checksum num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aec53c34f2d0247c5ca5d32cca1478762f301740468ee9ee6dcb7a0dd7a0c584" 520 | "checksum png 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f256476eee4447f55909d52d22a16cfa6e5e55e5cb77fa182c7fcc8c4456ee3c" 521 | "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" 522 | "checksum rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "eb250fd207a4729c976794d03db689c9be1d634ab5a1c9da9492a13d8fecbcdf" 523 | "checksum rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b614fe08b6665cb9a231d07ac1364b0ef3cb3698f1239ee0c4c3a88a524f54c8" 524 | "checksum rayon-core 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7febc28567082c345f10cddc3612c6ea020fc3297a1977d472cf9fdb73e6e493" 525 | "checksum redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "8dde11f18c108289bef24469638a04dce49da56084f2d50618b226e47eb04509" 526 | "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" 527 | "checksum rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "aee45432acc62f7b9a108cc054142dac51f979e69e71ddce7d6fc7adf29e817e" 528 | "checksum scoped_threadpool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3ef399c8893e8cb7aa9696e895427fab3a6bf265977bb96e126f24ddd2cda85a" 529 | "checksum scopeguard 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c79eb2c3ac4bc2507cda80e7f3ac5b88bd8eae4c0914d5663e6a8933994be918" 530 | "checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" 531 | "checksum structopt 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "619afea4e5ce98168397883dc7f2acaf3fd17a8fae7356bf7fc396d1d0a98aea" 532 | "checksum structopt-derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8de99f2018ff72fba4ff655fa451384aa2dd467c344fb6c4c8ae86fa8ccc2565" 533 | "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" 534 | "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" 535 | "checksum term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2b6b55df3198cc93372e85dd2ed817f0e38ce8cc0f22eb32391bfad9c4bf209" 536 | "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" 537 | "checksum textwrap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f728584ea33b0ad19318e20557cb0a39097751dbb07171419673502f848c7af6" 538 | "checksum unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8083c594e02b8ae1654ae26f0ade5158b119bd88ad0e8227a5d8fcd72407946" 539 | "checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" 540 | "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" 541 | "checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c" 542 | "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" 543 | "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" 544 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | description = "A terminal-based image viewer." 3 | name = "cleye" 4 | version = "0.1.0" 5 | authors = ["evanandrewrose "] 6 | license = "MIT" 7 | 8 | [dependencies] 9 | termion = "1.5.1" 10 | image = "0.15.0" 11 | structopt = "0.1.0" 12 | structopt-derive = "0.1.0" 13 | error-chain = "0.10.0" 14 | log = "0.3.8" 15 | loggerv = "0.2.0" 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cleye ![eog representation](https://travis-ci.org/evanandrewrose/cleye.svg?branch=master "Image captured via eog.") 2 | 3 | Terminal-based image viewer. 4 | 5 | cleye --help 6 | cleye 0.1.0 7 | evanandrewrose 8 | A simple terminal-based image viewer. 9 | 10 | USAGE: 11 | cleye [FLAGS] [OPTIONS] 12 | 13 | FLAGS: 14 | -h, --help Prints help information 15 | -n, --no_render Dry run, do not render. 16 | -V, --version Prints version information 17 | -v, --verbose Enable logging, use multiple `v`s to increase verbosity. 18 | 19 | OPTIONS: 20 | -f, --filter Filter to apply when resizing image. (Nearest, Triangle, CatmullRom, Gaussian, Lanczos3) [default: Nearest] 21 | -p, --pixel_width Number of characters for a given pixel. [default: 2] 22 | 23 | ARGS: 24 | Input file to present. 25 | 26 | # original 27 | ![eog representation](/img/eog_screen.png?raw=true "Image captured via eog.") 28 | 29 | # cleye 30 | ![cleye_representation](/img/tool_screen.png?raw=true "Image captured via cleye.") 31 | 32 | # system requirements 33 | 34 | Acquire rust and cargo from [rustup.rs](rustup.rs), then just run: 35 | 36 | # build 37 | 38 | cargo build 39 | 40 | # run 41 | 42 | cargo run 43 | 44 | # thanks 45 | 46 | This application was extremely easy to develop thanks to: 47 | 48 | - [termion](https://github.com/ticki/termion) 49 | - [image](https://github.com/PistonDevelopers/image) 50 | - [structopt](https://github.com/TeXitoi/structopt) 51 | - [error-chain](https://github.com/rust-lang-nursery/error-chain) 52 | - [log](https://github.com/rust-lang-nursery/log) 53 | - [loggerv](https://github.com/clux/loggerv) 54 | -------------------------------------------------------------------------------- /img/eog_screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evanandrewrose/cleye/b0b7888a2cf81a36ca914ef44dfff93ff284919e/img/eog_screen.png -------------------------------------------------------------------------------- /img/tool_screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evanandrewrose/cleye/b0b7888a2cf81a36ca914ef44dfff93ff284919e/img/tool_screen.png -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | extern crate image; 2 | extern crate termion; 3 | 4 | use std::path::Path; 5 | 6 | use image::GenericImage; 7 | 8 | use termion::raw::IntoRawMode; 9 | use image::imageops; 10 | use std::io::{stdout}; 11 | 12 | extern crate structopt; 13 | #[macro_use] extern crate structopt_derive; 14 | 15 | #[macro_use] extern crate error_chain; 16 | 17 | use structopt::StructOpt; 18 | 19 | #[macro_use] extern crate log; 20 | extern crate loggerv; 21 | 22 | #[derive(StructOpt, Debug)] 23 | #[structopt(name = "cleye", about = "A simple terminal-based image viewer.")] 24 | struct Opt { 25 | #[structopt(short = "f", long = "filter", help = "Filter to apply when resizing image. \ 26 | (Nearest, Triangle, CatmullRom, Gaussian, Lanczos3)", default_value = "Nearest")] 27 | filter: String, 28 | 29 | #[structopt(help = "Input file to present.")] 30 | file_path: String, 31 | 32 | #[structopt(short = "p", long = "pixel_width", help = "Number of characters for a given pixel.", default_value="2")] 33 | pixel_width: usize, 34 | 35 | #[structopt(short = "n", long = "no_render", help = "Dry run, do not render.")] 36 | no_render: bool, 37 | 38 | #[structopt(short = "v", long = "verbose", help = "Enable logging, use multiple `v`s to increase verbosity.")] 39 | verbosity: u64, 40 | } 41 | 42 | quick_main!(|| -> Result<()> { 43 | let opt = Opt::from_args(); 44 | 45 | loggerv::init_with_verbosity(opt.verbosity)?; 46 | 47 | let img = image::open(&Path::new(&opt.file_path)) 48 | .chain_err(|| format!("Can't open `{}`.", opt.file_path))?; 49 | 50 | debug!("Opened image `{}`.", opt.file_path); 51 | 52 | let term_size = termion::terminal_size() 53 | .chain_err(|| format!("Could not parse terminal size."))?; 54 | 55 | // Divide term_width by pixel_width since we'll use `pixel_width` num chars per pixel. 56 | let term_width = term_size.0 as u32 / (opt.pixel_width as u32); 57 | let term_height = term_size.1 as u32; 58 | 59 | debug!("Terminal size: `({}, {})` (width scale factor: {}).", term_width, term_height, opt.pixel_width); 60 | 61 | // Select our filter. 62 | let filter = match opt.filter.to_lowercase().as_ref() { 63 | "nearest" => Ok(imageops::FilterType::Nearest), 64 | "triangle" => Ok(imageops::FilterType::Triangle), 65 | "catmullrom" => Ok(imageops::FilterType::CatmullRom), 66 | "gaussian" => Ok(imageops::FilterType::Gaussian), 67 | "lanczos3" => Ok(imageops::FilterType::Lanczos3), 68 | _ => Err(format!("Unknown filter type `{}`. Try --help.", opt.filter)) 69 | }?; 70 | 71 | debug!("Selected filter: `{}`.", opt.filter); 72 | 73 | // Scale the image to the terminal size. 74 | let scaled_img = img.resize(term_width, term_height, filter); 75 | 76 | debug!("Scaled image size: `{:?}`.", scaled_img.dimensions()); 77 | 78 | // Acquire a reference to the terminal buffer. 79 | let mut stdout = stdout().into_raw_mode().unwrap(); 80 | 81 | if !opt.no_render { 82 | // Write our pixels as colorized spaces. 83 | for y in 0..(scaled_img.height()) { 84 | for x in 0..(scaled_img.width()) { 85 | let pixel = scaled_img.get_pixel(x, y); 86 | let (r, g, b) = (pixel[0], pixel[1], pixel[2]); 87 | 88 | write!(stdout, 89 | "{}{}", 90 | termion::color::Bg(termion::color::Rgb(r, g, b)), 91 | " ".repeat(opt.pixel_width)) 92 | .unwrap(); 93 | } 94 | write!(stdout, "\n\r").unwrap(); 95 | } 96 | } 97 | 98 | Ok(()) 99 | }); 100 | 101 | error_chain! { 102 | foreign_links { 103 | Log(::log::SetLoggerError); 104 | } 105 | } 106 | --------------------------------------------------------------------------------