IImageEncoder.cs 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #pragma warning disable CS1591
  2. using System;
  3. using System.Collections.Generic;
  4. using MediaBrowser.Model.Drawing;
  5. namespace MediaBrowser.Controller.Drawing
  6. {
  7. public interface IImageEncoder
  8. {
  9. /// <summary>
  10. /// Gets the supported input formats.
  11. /// </summary>
  12. /// <value>The supported input formats.</value>
  13. IReadOnlyCollection<string> SupportedInputFormats { get; }
  14. /// <summary>
  15. /// Gets the supported output formats.
  16. /// </summary>
  17. /// <value>The supported output formats.</value>
  18. IReadOnlyCollection<ImageFormat> SupportedOutputFormats { get; }
  19. /// <summary>
  20. /// Gets the display name for the encoder.
  21. /// </summary>
  22. /// <value>The display name.</value>
  23. string Name { get; }
  24. /// <summary>
  25. /// Gets a value indicating whether [supports image collage creation].
  26. /// </summary>
  27. /// <value><c>true</c> if [supports image collage creation]; otherwise, <c>false</c>.</value>
  28. bool SupportsImageCollageCreation { get; }
  29. /// <summary>
  30. /// Gets a value indicating whether [supports image encoding].
  31. /// </summary>
  32. /// <value><c>true</c> if [supports image encoding]; otherwise, <c>false</c>.</value>
  33. bool SupportsImageEncoding { get; }
  34. /// <summary>
  35. /// Get the dimensions of an image from the filesystem.
  36. /// </summary>
  37. /// <param name="path">The filepath of the image.</param>
  38. /// <returns>The image dimensions.</returns>
  39. ImageDimensions GetImageSize(string path);
  40. /// <summary>
  41. /// Gets the blurhash of an image.
  42. /// </summary>
  43. /// <param name="xComp">Amount of X components of DCT to take.</param>
  44. /// <param name="yComp">Amount of Y components of DCT to take.</param>
  45. /// <param name="path">The filepath of the image.</param>
  46. /// <returns>The blurhash.</returns>
  47. string GetImageBlurHash(int xComp, int yComp, string path);
  48. /// <summary>
  49. /// Encode an image.
  50. /// </summary>
  51. /// <param name="inputPath">Input path of image.</param>
  52. /// <param name="dateModified">Date modified.</param>
  53. /// <param name="outputPath">Output path of image.</param>
  54. /// <param name="autoOrient">Auto-orient image.</param>
  55. /// <param name="orientation">Desired orientation of image.</param>
  56. /// <param name="quality">Quality of encoded image.</param>
  57. /// <param name="options">Image processing options.</param>
  58. /// <param name="outputFormat">Image format of output.</param>
  59. /// <returns>Path of encoded image.</returns>
  60. string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, ImageOrientation? orientation, int quality, ImageProcessingOptions options, ImageFormat outputFormat);
  61. /// <summary>
  62. /// Create an image collage.
  63. /// </summary>
  64. /// <param name="options">The options to use when creating the collage.</param>
  65. /// <param name="libraryName">Optional. </param>
  66. void CreateImageCollage(ImageCollageOptions options, string? libraryName);
  67. /// <summary>
  68. /// Creates a new splashscreen image.
  69. /// </summary>
  70. /// <param name="posters">The list of poster paths.</param>
  71. /// <param name="backdrops">The list of backdrop paths.</param>
  72. void CreateSplashscreen(IReadOnlyList<string> posters, IReadOnlyList<string> backdrops);
  73. /// <summary>
  74. /// Creates a new trickplay tile image.
  75. /// </summary>
  76. /// <param name="options">The options to use when creating the image. Width and Height are a quantity of thumbnails in this case, not pixels.</param>
  77. /// <param name="quality">The image encode quality.</param>
  78. /// <param name="imgWidth">The width of a single trickplay thumbnail.</param>
  79. /// <param name="imgHeight">Optional height of a single trickplay thumbnail, if it is known.</param>
  80. /// <returns>Height of single decoded trickplay thumbnail.</returns>
  81. int CreateTrickplayTile(ImageCollageOptions options, int quality, int imgWidth, int? imgHeight);
  82. }
  83. }