IImageProcessor.cs 3.3 KB

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