IImageProcessor.cs 3.6 KB

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