GNU/Linux >> Linux の 問題 >  >> Ubuntu

どのような追加のサムナイラーが利用可能であり、それらをインストールする方法は?

質問

Ubuntuのファイルマネージャー、Nautilus 、ファイルプレビューの幅広いサポートが付属しています。これらのサムネイルは、サムネイル作成機能と呼ばれるヘルパープログラムによって処理されます。

Ubuntuにプリインストールされているサムネイルの数は限られているため、よりエキゾチックなファイルタイプはデフォルトでレンダリングされません。

このような場合にプレビューをアクティブにするために、どのような追加のサムネイルをインストールできますか?

関連するQ&A

サムネイルを事前に生成するようにNautilusに指示するにはどうすればよいですか?

コミュニティウィキの回答を編集して、このリストに自由に貢献してください。その場合は、このメタディスカッションのガイドラインに従い、既存のパターンを使用して回答の一貫性を維持してください。

承認された回答:

一般的なインストール手順

リポジトリとPPAのサムナイラー

多数のサムネイル機能が事前にパッケージ化されており、ソフトウェアセンターまたはコマンドラインから簡単にインストールできます。これらのサムネイルは追加の設定を必要とせず、nautilusを再起動した直後に機能するはずです。あなたはそうすることができます:

nautilus -q 

PPAから何かをインストールする前に、これらのQ&Aを読むことを検討してください:

PPAとは何ですか?どのように使用しますか?

PPAはシステムに安全に追加できますか?また、注意すべき「危険信号」は何ですか?

Ubuntu11.04以降のカスタムサムネイルスクリプト

リポジトリで使用できないカスタムサムネイルは、手動でインストールする必要があります。これらをインストールするために必要な手順は次のとおりです。

スクリプトに依存関係がリストされているかどうかを確認してください。その場合は、最初にインストールしてください。

スクリプトをダウンロードし、chmod a+x filethumbnailerを使用して実行可能にします。 またはノーチラス経由

今後のすべてのサムネイル作成者用にファイルシステム内のフォルダを指定し、スクリプトをそのフォルダに移動します。例:

mkdir $HOME/.scripts/thumbnailers && mv filethumbnailer $HOME/.scripts/thumbnailers

次に、スクリプトを Nautilusに登録する必要があります 。これを行うには、/usr/share/thumbnailersにサムネイルエントリを作成します 。エントリは、命名スキームfoo.thumbnailerに従う必要があります ここで、foo は選択した式です(ここではfile ):

gksudo gedit /usr/share/thumbnailers/file.thumbnailer

サムネイルの仕様は次のスキームに従います:

[Thumbnailer Entry]
Exec=$HOME/.scripts/thumbnailers/file.thumbnailer %i %o %s
MimeType=application/file;

Exec MimeTypeの間、エントリはサムネイルスクリプトを指します フィールドは、関連するMimeTypeを指定します。可能な変数は次のとおりです。

%i Input file path
%u Input file URI
%o Output file path
%s Thumbnail size (vertical)

仕様と変数は、スクリプトごとに異なります。それぞれのテキストボックスの内容をコピーしてファイルに貼り付け、保存するだけです。

nautilus(nautilus -q)を再起動すると、サムネイル機能が起動して実行されます。 。

Ubuntu11.04以下のカスタムサムネイルスクリプト

Ubuntuの以前のバージョンは、サムネイルの関連付けをGConfに依存しています。詳細については、こちらをご覧ください。

ソース

https://live.gnome.org/ThumbnailerSpec

https://bugzilla.redhat.com/show_bug.cgi?id=636819#c29

https://bugs.launchpad.net/ubuntu/+source/gnome-exe-thumbnailer/+bug/752578

http://ubuntuforums.org/showthread.php?t=1881360

ファイルタイプ別のサムナイラー

CHMファイル

概要

説明 :このスクリプトを使用すると、nautilusファイルマネージャーでchmファイルのサムネイルを
取得できます。スクリプトは、chmファイルのホームページからの最大の画像を
使用してサムネイルを生成します。通常、これは
表紙の画像になります。

作成者 :monraaf
(http://ubuntuforums.org/showthread.php?t=1159569)

依存関係sudo apt-get install python-beautifulsoup python-chm imagemagick

サムナイラーエントリー

[Thumbnailer Entry]
Exec=$HOME/.scripts/thumbnailers/chmthumbnailer %i %o %s
MimeType=application/vnd.ms-htmlhelp;application/x-chm;

スクリプト

#!/usr/bin/env python

import sys, os
from chm import chm
from BeautifulSoup import BeautifulSoup

class ChmThumbNailer(object):
    def __init__(self):
        self.chm = chm.CHMFile()

    def thumbnail(self, ifile, ofile, sz):

        if self.chm.LoadCHM(ifile) == 0:
            return 1

        bestname    = None
        bestsize    = 0
        base        = self.chm.home.rpartition('/')[0] + '/'
        size, data  = self.getfile(self.chm.home)

        if size > 0:
            if self.chm.home.endswith(('jpg','gif','bmp')):
                self.write(ofile, sz, data)
            else:
                soup = BeautifulSoup(data)
                imgs = soup.findAll('img')
                for img in imgs:
                    name = base + img.get("src","")
                    size, data = self.getfile(name)
                    if size > bestsize:
                        bestsize = size
                        bestname = name
                if bestname != None:
                    size, data = self.getfile(bestname)
                    if size > 0:
                        self.write(ofile, sz, data)
        self.chm.CloseCHM()

    def write(self, ofile, sz, data):
        fd = os.popen('convert - -resize %sx%s "%s"' % (sz, sz, ofile), "w")
        fd.write(data)
        fd.close()

    def getfile(self,name):
        (ret, ui) = self.chm.ResolveObject(name)
        if ret == 1:
            return (0, '')
        return self.chm.RetrieveObject(ui)

if len(sys.argv) > 3:
    chm = ChmThumbNailer()
    chm.thumbnail(sys.argv[1], sys.argv[2], sys.argv[3])

EPUBファイル

関連:DellラップトップのUefiマザーボードを変更しましたが、UbuntuでOSが検出されないと表示されますか?

概要

説明 :epub-thumbnailerは、epubファイルでカバーを見つけて、そのサムネイルを作成する簡単なスクリプトです。

作成者 :Mariano Simone
(https://github.com/marianosimone/epub-thumbnailer)

依存関係 :リストされていない、すぐに正常に動作した

サムナイラーエントリー

[Thumbnailer Entry]
Exec=$HOME/.scripts/thumbnailers/epubthumbnailer %i %o %s
MimeType=application/epub+zip;

スクリプト

#!/usr/bin/python

#  This program 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.
#
#  This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.

# Author: Mariano Simone ([email protected])
# Version: 1.0
# Name: epub-thumbnailer
# Description: An implementation of a cover thumbnailer for epub files
# Installation: see README

import zipfile
import sys
import Image
import os
import re
from xml.dom import minidom
from StringIO import StringIO

def get_cover_from_manifest(epub):
    img_ext_regex = re.compile("^.*.(jpg|jpeg|png)$")

    # open the main container
    container = epub.open("META-INF/container.xml")
    container_root = minidom.parseString(container.read())

    # locate the rootfile
    elem = container_root.getElementsByTagName("rootfile")[0]
    rootfile_path = elem.getAttribute("full-path")

    # open the rootfile
    rootfile = epub.open(rootfile_path)
    rootfile_root = minidom.parseString(rootfile.read())

    # find the manifest element
    manifest = rootfile_root.getElementsByTagName("manifest")[0]
    for item in manifest.getElementsByTagName("item"):
        item_id = item.getAttribute("id")
        item_href = item.getAttribute("href")
        if "cover" in item_id and img_ext_regex.match(item_href.lower()):
            cover_path = os.path.join(os.path.dirname(rootfile_path), 
                                      item_href)
            return cover_path

    return None

def get_cover_by_filename(epub):
    cover_regex = re.compile(".*cover.*.(jpg|jpeg|png)")

    for fileinfo in epub.filelist:
        if cover_regex.match(os.path.basename(fileinfo.filename).lower()):
            return fileinfo.filename

    return None

def extract_cover(cover_path):
    if cover_path:
        cover = epub.open(cover_path)
        im = Image.open(StringIO(cover.read()))
        im.thumbnail((size, size), Image.ANTIALIAS)
        im.save(output_file, "PNG")
        return True
    return False

# Which file are we working with?
input_file = sys.argv[1]
# Where do does the file have to be saved?
output_file = sys.argv[2]
# Required size?
size = int(sys.argv[3])

# An epub is just a zip
epub = zipfile.ZipFile(input_file, "r")

extraction_strategies = [get_cover_from_manifest, get_cover_by_filename]

for strategy in extraction_strategies:
    try:
        cover_path = strategy(epub)
        if extract_cover(cover_path):
            exit(0)
    except Exception as ex:
        print "Error getting cover using %s: " % strategy.__name__, ex

exit(1)

EXEファイル

概要

説明 :gnome-exe-thumbnailerは、Gnomeのサムネイル作成機能であり、Windows.exeファイルに埋め込まれたアイコンと
一般的な「ワインプログラム」アイコンに基づいたアイコンを提供します。プログラムに通常の実行権限がある場合は、
標準の埋め込みアイコンが表示されます。この
サムネイルは、.jar、.py、および同様の
実行可能プログラムのサムネイルアイコンも提供します。

可用性 :公式リポジトリ

インストール

sudo apt-get install gnome-exe-thumbnailer

ODP / ODS/ODTおよびその他のLibreOfficeおよびOpenOfficeファイル

関連:Ubuntu 18.04ログインループ?

概要

説明: ooo-thumbnailerは、LibreOffice、OpenOffice.org、およびMicrosoft Officeのドキュメントサムネイルであり、Nautilusが
ドキュメント、スプレッドシート、プレゼンテーション、および
図面のサムネイルを作成するために使用できます。

可用性 :開発者のPPA(Ubuntu 12.04以降のLibreOfficeと互換性のある最新バージョン)

インストール

sudo add-apt-repository ppa:flimm/ooo-thumbnailer && apt-get update && apt-get install ooo-thumbnailer

Ubuntu
  1. Ubuntu20.04にSiegeベンチマークツールをインストールして使用する方法

  2. Dockerログ:ログとは何かとその使用方法(例を含む)

  3. g++ を Ubuntu にインストールする方法

  1. NFSとは何ですか?Linuxにインストールする方法

  2. Gcc 4.7をインストールするにはどうすればいいですか?

  3. UbuntuデスクトップGUIの選択肢は何ですか?それらを有効にする方法は?

  1. Dockerボリュームとは何ですか?また、それらをどのように使用しますか?

  2. SELinux モードとは何か、およびその設定方法

  3. シンボリック リンク (ソフト リンク) とは何か、および Linux でそれらを作成する方法