This file is indexed.

/usr/bin/mypaint-ora-thumbnailer is in mypaint 1.2.0-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#! /usr/bin/python2.7
#
# ***DO NOT EDIT THIS FILE***: edit desktop/mypaint-ora-thumbnailer.py instead.
#
# Auto-generated version info:
MYPAINT_VERSION_BASE='1.2.0'
MYPAINT_VERSION_FORMAL='1.2.0'
MYPAINT_VERSION_CEREMONIAL='1.2.0+gitexport.f62444e'
# Thumbnailer for GNOME/Cinnamon Nautilus, and compatible desktops.
#
# Copyright (c)  2010 Jon Nordby <jononor@gmail.com>
#           (c)  2013-2015 Andrew Chadwick <a.t.chadwick@gmail.com>
# This program is distributed under the same terms as MyPaint itself.

# OpenRaster specification:
# http://freedesktop.org/wiki/Specifications/OpenRaster/Draft/FileLayout
#
# This can be used with earlier versions of GNOME by setting some gconf keys:
# http://library.gnome.org/devel/integration-guide/stable/thumbnailer.html.en
# However the MyPaint distribution does not do this in order to avoid a
# dependency on gconf.
#
# GNOME 3.0 thumbnailing requires a .thumbnailer file under $XDG_DATA_DIRS,
# subfolder "thumbnailers".
# http://www.ict.griffith.edu.au/anthony/info/X/Thumbnailing.txt Since this
# just requires files to be installed, we support that (and assume your
# installation prefix is one of the $XDG_DATA_DIRS:
# http://standards.freedesktop.org/basedir-spec/ )
#
# You will also need to tell your desktop environment about the
# image/openraster MIME type. Support is available in Debian-derived OSes in
# the shared-mime-info package, or see
# http://standards.freedesktop.org/shared-mime-info-spec/

import zipfile
from gi.repository import GdkPixbuf


def ora_thumbnail(infile, outfile, size):
    """Extracts an OpenRaster file's thumbnail to PNG, with scaling."""

    # Extract a GdkPixbuf from the OpenRaster file
    png_data = zipfile.ZipFile(infile).read('Thumbnails/thumbnail.png')
    loader = GdkPixbuf.PixbufLoader()
    loader.write(png_data)
    loader.close()
    pixbuf = loader.get_pixbuf()

    # Scale if needed
    orig_w = pixbuf.get_width()
    orig_h = pixbuf.get_height()
    if orig_w > size or orig_h > size:
        scale_factor = float(size) / max(orig_w, orig_h)
        new_w = int(orig_w * scale_factor)
        new_h = int(orig_h * scale_factor)
        pixbuf = pixbuf.scale_simple(
            new_w, new_h,
            GdkPixbuf.InterpType.BILINEAR,
        )

    # Save. The output file is a temporary one created by
    # GNOME::ThumbnailFactory, which overwrites any options we add
    # with its own Thumb::MTime and Thumb::URI.
    pixbuf.savev(outfile, "png", [], [])
    # Hopefully the method name won't change for posix typelibs.


if __name__ == '__main__':
    import sys
    try:
        progname, infile, outfile, size = sys.argv
    except ValueError:
        sys.exit('Usage: %s <Input> <Output> <Size>' % sys.argv[0])
    ora_thumbnail(infile, outfile, int(size))