.controllers._gif.Cropper

class controllers._gif.cropper.Cropper(info: model.gif_info.GifInfo, box: model.units.CropBox, preserve_fps: bool)

Controller responsible for cropping and exporting a given GIF file.

Initializer

controllers._gif.Cropper.__init__(self, info: model.gif_info.GifInfo, box: model.units.CropBox, preserve_fps: bool)

Initializes a new Cropper object.

Parameters
  • info (model.GifInfo) – Object containing the GIF file information

  • box (model.units.CropBox) – selected crop coordinates as a named tuple: CropBox(x0, y0, x1, y1)

  • preserve_fps (bool) – Preserves the input frame rate if True


Location

/controllers/_gif/cropper.py

Instance functions

controllers._gif.Cropper.export_gif(self) str | None

Exports a cropped GIF file according to current instance values.

Returns

The output file path if successful

Return type

str | None


Internal instance functions

controllers._gif.Cropper._run_export(self, output: str) str | None

Submits the GIF file writing task as a thread, displaying its progress in a popup window.

Returns

The output file path if successful

Return type

str | None


controllers._gif.Cropper._write_task(self, output) str | None

Writes the cropped GIF file output.

Returns

The output file path if successful

Return type

str | None


controllers._gif.Cropper._fix_export_fps(self, output) None

Sets cropper _export_fps value as the input frame rate by reading the first output number of frames.


Internal module function

controllers._gif.cropper._show_running(task: concurrent.futures._base.Future[str]) None

Displays the running exporting task progress in a popup window.

Parameters

task (Future[str]) – Running export task


Source code (on GitHub)