mickle026 401 Posted February 8, 2023 Share Posted February 8, 2023 I have absolutely no idea how to use skia sharp, let alone how to use it in emby. I would like an example if anyone is willing?? on how to use it (impliment it) and then use it to take sections of images I already know I need to create a canvas and draw on it, but I simply dont have a clue how. I can do it in ffmpeg, so I can still do this within the emby environment but I would like to learn how to do it with skia sharp This is what I mean, this will take an image and cut it in half 50% left 50% right, creating two seperate images. ffmpeg.exe -i image.jpg -filter_complex "[0]crop=iw/2:ih:0:0[left];[0]crop=iw/2:ih:ow:0[right]" -map "[left]" left.jpg -map "[right]" right.jpg Help would be appreciated ! Link to comment Share on other sites More sharing options...
Cheesegeezer 3087 Posted February 8, 2023 Share Posted February 8, 2023 @chef Link to comment Share on other sites More sharing options...
ebr 14921 Posted February 8, 2023 Share Posted February 8, 2023 @roaku Link to comment Share on other sites More sharing options...
roaku 795 Posted February 8, 2023 Share Posted February 8, 2023 I guess start with including SkiaSharp in your project if you haven't: <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>netstandard2.0</TargetFrameworks> <AssemblyVersion>{whatever version}</AssemblyVersion> <FileVersion>{whatever version}</FileVersion> <OutputType>Library</OutputType> </PropertyGroup> <ItemGroup> <PackageReference Include="mediabrowser.server.core" Version="{whatever version}" /> <PackageReference Include="System.Memory" Version="{whatever version}" /> <!-- You'll need to provide an ImageMagickSharp implementation of your code too if you want to support all Emby platforms --> <PackageReference Include="ImageMagickSharp" Version="{whatever version}" /> <PackageReference Include="SkiaSharp" Version="2.88.3" /> </ItemGroup> ... </Project> Link to comment Share on other sites More sharing options...
mickle026 401 Posted February 8, 2023 Author Share Posted February 8, 2023 33 minutes ago, roaku said: I guess start with including SkiaSharp in your project if you haven't: <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>netstandard2.0</TargetFrameworks> <AssemblyVersion>{whatever version}</AssemblyVersion> <FileVersion>{whatever version}</FileVersion> <OutputType>Library</OutputType> </PropertyGroup> <ItemGroup> <PackageReference Include="mediabrowser.server.core" Version="{whatever version}" /> <PackageReference Include="System.Memory" Version="{whatever version}" /> <!-- You'll need to provide an ImageMagickSharp implementation of your code too if you want to support all Emby platforms --> <PackageReference Include="ImageMagickSharp" Version="{whatever version}" /> <PackageReference Include="SkiaSharp" Version="2.88.3" /> </ItemGroup> ... </Project> Thanks, thats a given ...... I can do everything I want to do with ffmpeg - either by caching files or with a stream pipe server - so direct transfer into the plugin, but i'd really like to do this internally with the provided image libraries instead of waiting for an outside process to complete. I know its strange that i can do something advanced like that with ffmpeg already and not know how to impliment skia or imagemagik, but thats how it is .... I only learned what I needed to at the time i needed to, im not an advanced programmer but a novice with some very good skills in some areas, but lacking drastically in others Link to comment Share on other sites More sharing options...
roaku 795 Posted February 8, 2023 Share Posted February 8, 2023 @mickle026 Are you wanting to modify the original images in a task or UI...or use Emby's image api to generate the edited images as they're requested by a client? Link to comment Share on other sites More sharing options...
mickle026 401 Posted February 8, 2023 Author Share Posted February 8, 2023 (edited) This question is mainly about the UI. I'm wanting to modify mainly poster images when I fetch them from an external source. Such as pulling full covers ( both sides) and cropping out the front posters, Or pulling people images and cropping them to portraits. Some images I want to crop/stretch to a wide-screen and also make thumbnails. Like I said I can do all this with ffmpeg already, but using skia and Imagemagik would be a better way to do it . Edited February 8, 2023 by mickle026 Link to comment Share on other sites More sharing options...
roaku 795 Posted February 8, 2023 Share Posted February 8, 2023 (edited) 14 minutes ago, mickle026 said: This question is mainly about the UI. I'm wanting to modify mainly poster images when I fetch them from an external source. Such as pulling full covers ( both sides) and cropping out the front posters, Or pulling people images and cropping them to portraits. Some images I want to crop/stretch to a wide-screen and also make thumbnails. Like I said I can do all this with ffmpeg already, but using skia and Imagemagik would be a better way to do it . This would be a good place for you to start I think: https://github.com/MediaBrowser/Emby/blob/master/Emby.Drawing.Skia/StripCollageBuilder.cs It has everything from loading images from a path, a bunch of different modifications, and saving the final image. You can use the SkiaSharp docs to reference as you go along: https://learn.microsoft.com/en-us/dotnet/api/skiasharp.skbitmap.resize?view=skiasharp-2.88 In terms of the UI, I imagine you'd have to set up your own API endpoints to carry out actions based on actions taken in the UI. That's just general plugin stuff. Edited February 8, 2023 by roaku 1 Link to comment Share on other sites More sharing options...
mickle026 401 Posted February 8, 2023 Author Share Posted February 8, 2023 1 hour ago, roaku said: This would be a good place for you to start I think: https://github.com/MediaBrowser/Emby/blob/master/Emby.Drawing.Skia/StripCollageBuilder.cs It has everything from loading images from a path, a bunch of different modifications, and saving the final image. You can use the SkiaSharp docs to reference as you go along: https://learn.microsoft.com/en-us/dotnet/api/skiasharp.skbitmap.resize?view=skiasharp-2.88 In terms of the UI, I imagine you'd have to set up your own API endpoints to carry out actions based on actions taken in the UI. That's just general plugin stuff. At work right now, but thanks for pointing me in the right direction I'll take a look and repost if I need more help. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now