2
0

IImageProcessor.cs 3.3 KB

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