IImageProcessor.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Threading.Tasks;
  5. using MediaBrowser.Controller.Entities;
  6. using MediaBrowser.Model.Drawing;
  7. using MediaBrowser.Model.Entities;
  8. namespace MediaBrowser.Controller.Drawing
  9. {
  10. /// <summary>
  11. /// Interface IImageProcessor
  12. /// </summary>
  13. public interface IImageProcessor
  14. {
  15. /// <summary>
  16. /// Gets the supported input formats.
  17. /// </summary>
  18. /// <value>The supported input formats.</value>
  19. IReadOnlyCollection<string> SupportedInputFormats { get; }
  20. /// <summary>
  21. /// Gets a value indicating whether [supports image collage creation].
  22. /// </summary>
  23. /// <value><c>true</c> if [supports image collage creation]; otherwise, <c>false</c>.</value>
  24. bool SupportsImageCollageCreation { get; }
  25. /// <summary>
  26. /// Gets the dimensions of the image.
  27. /// </summary>
  28. /// <param name="path">Path to the image file.</param>
  29. /// <returns>ImageDimensions</returns>
  30. ImageDimensions GetImageDimensions(string path);
  31. /// <summary>
  32. /// Gets the dimensions of the image.
  33. /// </summary>
  34. /// <param name="item">The base item.</param>
  35. /// <param name="info">The information.</param>
  36. /// <returns>ImageDimensions</returns>
  37. ImageDimensions GetImageDimensions(BaseItem item, ItemImageInfo info);
  38. /// <summary>
  39. /// Gets the blurhash of the image.
  40. /// </summary>
  41. /// <param name="path">Path to the image file.</param>
  42. /// <returns>BlurHash</returns>
  43. string GetImageBlurHash(string path);
  44. /// <summary>
  45. /// Gets the image cache tag.
  46. /// </summary>
  47. /// <param name="item">The item.</param>
  48. /// <param name="image">The image.</param>
  49. /// <returns>Guid.</returns>
  50. string GetImageCacheTag(BaseItem item, ItemImageInfo image);
  51. string GetImageCacheTag(BaseItem item, ChapterInfo info);
  52. /// <summary>
  53. /// Processes the image.
  54. /// </summary>
  55. /// <param name="options">The options.</param>
  56. /// <param name="toStream">To stream.</param>
  57. /// <returns>Task.</returns>
  58. Task ProcessImage(ImageProcessingOptions options, Stream toStream);
  59. /// <summary>
  60. /// Processes the image.
  61. /// </summary>
  62. /// <param name="options">The options.</param>
  63. /// <returns>Task.</returns>
  64. Task<(string path, string mimeType, DateTime dateModified)> ProcessImage(ImageProcessingOptions options);
  65. /// <summary>
  66. /// Gets the supported image output formats.
  67. /// </summary>
  68. /// <returns><see cref="IReadOnlyCollection{ImageOutput}" />.</returns>
  69. IReadOnlyCollection<ImageFormat> GetSupportedImageOutputFormats();
  70. /// <summary>
  71. /// Creates the image collage.
  72. /// </summary>
  73. /// <param name="options">The options.</param>
  74. void CreateImageCollage(ImageCollageOptions options);
  75. bool SupportsTransparency(string path);
  76. }
  77. }