LoginSignup
0
0

More than 3 years have passed since last update.

Python Help(writeGif)

Last updated at Posted at 2018-09-03

英語がわからないので機械翻訳しました。

Python Help(writeGif)

モジュール : images2gif
from images2gif import writeGif

writeGif

PILイメージをGIFに変換して保存する。

記述方法

writeGif(filename, images, duration=0.1, repeat=True, dither=False, nq=0, subRectangles=True, dispose=None)

  • filename : 'string' ファイル名
  • images : 'list' PILイメージ
  • duration=0.1 : 'float' or 'lust' スカラー
  • repeat=True : 'bool' or 'integer' ループの回数(Trueか0は無限ループ、数値は回数)
  • dither=False : 'bool' ディザリング
  • nq=0 : 'integer' ゼロでない場合は、NeuQuantの量子化アルゴリズムを適用してカラーパレットを作成します。このアルゴリズムは優れていますが、標準的なPILアルゴリズムよりも遅いです。 nqの値は品質パラメータです。 1は最高の品質を表します。 10は、一般に、品質と速度との間の良好なトレードオフである。このオプションを使用すると、通常、subRectanglesがFalseのときより良い結果が得られます。
  • subRectangles=True:'False','True','list'[(n, m),...] サブ長方形を使用するかどうか。 Trueの場合、各フレームを更新するために必要な最小の長方形が自動的に検出されます。これにより、特にイメージの一部のみが変更された場合に、ファイルサイズが大幅に削減されます。あなたは自分でトリミングを行う場合は、x-y座標のリストを与えることもできます。デフォルトはTrueです。
  • dispose=None : 'int' 各フレームを廃棄する方法。 1は、各フレームをそのまま残すことを意味します。 2は、各フレームの後に背景色を復元する必要があることを意味します。 3は、デコーダが前のフレームを復元すべきであることを意味する。 subRectangles == Falseの場合、デフォルトは2です。それ以外の場合は1です。

>>>help(writeGif)

images2gif.writeGif
Help on function writeGif in module images2gif:

writeGif(filename, images, duration=0.1, repeat=True, dither=False, nq=0, subRectangles=True, dispose=None)
    writeGif(filename, images, duration=0.1, repeat=True, dither=False,
                    nq=0, subRectangles=True, dispose=None)

    Write an animated gif from the specified images.

    Parameters
    ----------
    filename : string
        The name of the file to write the image to.
    images : list
        Should be a list consisting of PIL images or numpy arrays.
        The latter should be between 0 and 255 for integer types, and
        between 0 and 1 for float types.
    duration : scalar or list of scalars
        The duration for all frames, or (if a list) for each frame.
    repeat : bool or integer
        The amount of loops. If True or 0, loops infinitely. If False or
        1, will play once then stop. If some other int N, loops N times.
    dither : bool
        Whether to apply dithering
    nq : integer
        If nonzero, applies the NeuQuant quantization algorithm to create
        the color palette. This algorithm is superior, but slower than
        the standard PIL algorithm. The value of nq is the quality
        parameter. 1 represents the best quality. 10 is in general a
        good tradeoff between quality and speed. When using this option, 
        better results are usually obtained when subRectangles is False.
    subRectangles : False, True, or a list of 2-element tuples
        Whether to use sub-rectangles. If True, the minimal rectangle that
        is required to update each frame is automatically detected. This
        can give significant reductions in file size, particularly if only
        a part of the image changes. One can also give a list of x-y 
        coordinates if you want to do the cropping yourself. The default
        is True.
    dispose : int
        How to dispose each frame. 1 means that each frame is to be left
        in place. 2 means the background color should be restored after
        each frame. 3 means the decoder should restore the previous frame.
        If subRectangles==False, the default is 2, otherwise it is 1.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0