View Source Thumbnex (thumbnex v0.5.1)

Create thumbnails from images and videos.

Summary

Functions

Link to this function

animated_gif_thumbnail(input_path, output_path, opts \\ [])

View Source
@spec animated_gif_thumbnail(binary(), binary(), Keyword.t()) ::
  :ok | {:error, {Collectable.t(), exit_status :: non_neg_integer()}}

Create an animated GIF preview.

Options:

  • :width - Width of the thumbnail. Defaults to input width.
  • :height - Height of the thumbnail. Defaults to input height.
  • :max_width - Maximum width of the thumbnail.
  • :max_height - Maximum height of the thumbnail.
  • :frame_count - Number of frames to output. Default 4.
  • :fps - Frames per second of output GIF. Default 1.
  • :optimize - Add mogrify options to reduce output size. Default true.
Link to this function

create_thumbnail(input_path, output_path, opts \\ [])

View Source
@spec create_thumbnail(binary(), binary(), Keyword.t()) :: :ok | {:error, any()}

Create a thumbnail image.

Image format is inferred from output path file extension. To override, pass the :format option.

Return :ok if everything goes well or {:error, error_output}

Options:

  • :width - Width of the thumbnail. Defaults to input width.
  • :height - Height of the thumbnail. Defaults to input height.
  • :max_width - Maximum width of the thumbnail.
  • :max_height - Maximum height of the thumbnail.
  • :format - Output format for the thumbnail. Defaults to output_path extension, or "png" if indeterminate.
  • :time_offset - Timestamp in seconds at which to take screenshot, for videos and GIFs. By default picks a time near the beginning, based on video duration.