IImageProcessor.cs 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 image cache tag.
  48. /// </summary>
  49. /// <param name="item">The item.</param>
  50. /// <param name="image">The image.</param>
  51. /// <returns>Guid.</returns>
  52. string GetImageCacheTag(BaseItem item, ItemImageInfo image);
  53. string GetImageCacheTag(BaseItem item, ChapterInfo chapter);
  54. string? GetImageCacheTag(User user);
  55. /// <summary>
  56. /// Processes the image.
  57. /// </summary>
  58. /// <param name="options">The options.</param>
  59. /// <param name="toStream">To stream.</param>
  60. /// <returns>Task.</returns>
  61. Task ProcessImage(ImageProcessingOptions options, Stream toStream);
  62. /// <summary>
  63. /// Processes the image.
  64. /// </summary>
  65. /// <param name="options">The options.</param>
  66. /// <returns>Task.</returns>
  67. Task<(string path, string? mimeType, DateTime dateModified)> ProcessImage(ImageProcessingOptions options);
  68. /// <summary>
  69. /// Gets the supported image output formats.
  70. /// </summary>
  71. /// <returns><see cref="IReadOnlyCollection{ImageOutput}" />.</returns>
  72. IReadOnlyCollection<ImageFormat> GetSupportedImageOutputFormats();
  73. /// <summary>
  74. /// Creates the image collage.
  75. /// </summary>
  76. /// <param name="options">The options.</param>
  77. /// <param name="libraryName">The library name to draw onto the collage.</param>
  78. void CreateImageCollage(ImageCollageOptions options, string? libraryName);
  79. bool SupportsTransparency(string path);
  80. }
  81. }