Git Product home page Git Product logo

thumbnailer's Introduction

Thumbnailer

Build Status codecov

Thumbnailer is an app for creating thumbnails following the XDG standard version 0.8.0.

Useful for creating thumbnails in advance for big folders if you use a file manager complaint with the xdg standard (for example Gnome Nautilus aka "Files" or KDE Dolphin).

Supported features

  • Creation of normal thumbs
  • Creation of large thumbs
  • Saving in XDG directory
  • Saving original image last modification image in thumb PNG metadata
  • Threaded image creation
  • Shared repositories

Usage

Thumbnailer.

Usage:
  thumbnailer [-v] [-r] [--jobs=<num>] (-n|-l|-n -l) (--output=<dir>|-x) <directory>
  thumbnailer [-v] [--jobs=<num>] (-n|-l|-n -l) -s <directory>
  thumbnailer (-h | --help)
  thumbnailer (-v | --verbose)

Options:
  -h --help           Show this screen.
  --version           Show version.
  -v --verbose        Verbose output.
  -r --recursive      Recursive scan.
  -n --normal         Generate normal thumbs.
  -l --large          Generate large thumbs.
  -j --jobs=<num>     Number of parallel jobs [default: 1]
  -o --output=<dir>   Output to custom directory
  -x --xdg            Output to XDG directory
  -s --shared         Output to shared repository directory

Building

cargo build --release

thumbnailer's People

Contributors

filcuc avatar kennylevinsen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

thumbnailer's Issues

Supported image formats

As far I understood only JPEG and PNG are currently supported. https://github.com/filcuc/thumbnailer/blob/master/src/main.rs#L98
Maybe other formats like WEBP aren't needed for now but I'm anyway interested to know possibilities.
Could you please explain from where their support comes from? How many other formats are supported?

Currently I looking for a thumbnailer that will work on OpenWRT on my router and disk space is very limited. So if the underlying image library supports dozens of file formats then I'm afraid that the final binary wont' fit into a small flash disk.

Shared thumbnail file URI seems incorrect

The URI used for shared thumbnails is relative to file being thumbnailed. E.g., for a picture /home/user/picture.png, a relative URI to the picture would be like so: picture.png. However, thumbnailer uses file://picture.png.

The wording in the spec is rather confusing, but picture.png is what the in-progress glib work uses (https://gitlab.gnome.org/GNOME/glib/-/issues/654), and how the URI RFC defines relative URIs.

(I'll post a PR later.)

Move to destination not atomic

When creating thumbnails, thumbnailer creates temporary files in what is returned by std::env::temp_dir() (this will generally be /tmp), and then runs the mv command to move them into place.

Move can only be atomic within the same filesystem, using the rename system call. As /tmp is commonly tmpfs, the move will commonly be crossing filesystem boundaries, this is not possible, and the mv command ends up doing a copy instead.

This renders the entire operation moot, as this copy is no better than just writing straight to the destination in the first place.

The way this is usually dealt with is to use the destination for the temp file using temporary name (e.g. <MD5_OF_URI>_tmp.png or <MD5_OF_URI>.png.tmp).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.