AllMyToes

A simple program to provide thumbnails for images by using the freedesktop-specified thumbnail data-base.

AllMyToes is in an early development state but it’s usable.

[[TOC]]

Usage

Call allmytoes with an image as parameter. The program will print the path to a thumbnail to stdout. ```

allmytoes some_image.jpg /home/me/.cache/thumbnails/normal/b7931d1d6e0439c1a6e2e6b02c5b21a6.png ```

If the thumbnail already exists, AllMyToes will just return the path to the existing thumbnail file. If not, AllMyToes will create the image’s thumbnails for the requested and all other supported sizes first.

Thumbnail Size

The latest freedesktop specification (0.9.0) defines four different thumbnail sizes: normal, large, x-large, and xx-large with maximum edge lengths of 128 px, 256 px, 512 px, and 1024 px respectively.

By default, AllMyToes returns the path to the large (256 px) thumbnail. The size to be returned can be chosen with the -s (--size) option by giving a value out of {n, l, x, xx}.

For example, to get a xx-large thumbnail, the call would look like this: ```

allmytoes -sxx some_image.jpg /home/me/.cache/thumbnails/xx-large/ad0779df58de36f038bdc4040a322bfe.png ```

How is this useful?

My personal motivation was the use of thumbnails for image previews in terminal-based file managers like (joshuto and ranger).

But I guess AllMyToes can be useful for many situation where one wants to show a size-limited image in scripted environments, maybe as icons in desktop notifications or as desktop-overlays in terminal-based applications.

You may prefer to use this instead of AllMyToes

AllMyToes as a Library

AllMyToes can be used as a Rust library to obtain a thumbnail for a given image.

AllMyToes has a very small interface which just provides one function to get the thumbnail (get_thumbnail), one struct to specify the thumbnail size (ThumbSize), and one enum for the possible errors (ToeErrorType).

Example

```rust use allmytoes::{get_thumbnail, ThumbSize};

fn main() { let thumbsize = ThumbSize::Normal; match getthumbnail(String::from("/path/to/source/image"), ThumbSize::Normal) { Ok(pathtothumb) => { println!( "The path to the thumb with size {} (maximum width/heigh: {}px) can be found here: {}", thumbsize.dirname(), thumbsize.maxthumbwidth(), pathto_thumb ) } Err(error) => println!( "Error '{:?}' occurred when trying to provide the thumb. ({})", error, error.msg(), ), } } ```

License

AllMyToes is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

AllMyToes is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with AllMyToes. If not, see https://www.gnu.org/licenses/.

Notes

Freedesktop Thumbnail Specification

To Test

Random

Standard

File Format

The standard says

The image format for thumbnails is the PNG format, regardless in which format the original file was saved. To be more specific it must be a 8bit, non-interlaced PNG image with full alpha transparency (means 255 possible alpha values). However, every program should use the best possible quality when creating the thumbnail. The exact meaning of this is left to the specific program but it should consider applying antialiasing.

Not sure what to make from that.