OnlyM
OnlyM copied to clipboard
Enable support for SVG images
Is your feature request related to a problem? Please describe. Some newer publications have SVG images instead of JPG, such as the Teaching Box in the current CBS book. For now, I'm converting these to png using Imagemagick.
Describe the solution you'd like OnlyM would be able to display an SVG image.
Describe alternatives you've considered Converting the image to a supported format, such as JPG or PNG.
Additional context
Support for SVG images would make it easier for Media to import images for newer publications without having to convert the images
@AntonyCorbett I would like to take on this issue. Any information you can provide on how to build this project locally, run tests etc. would be helpful. Thank you!
@Notabela Thanks for your kind offer - please go ahead. The solution is currently built in VS 2019 and there are a small number of integration tests in the IntegrationTests project. Please feel free to add tests if needed. Regarding SVG support, one option may be to create a Converter so that the image can be displayed in the existing Image component.
If you make changes to the string resources (resources.resx, etc) please don't include in your PR any non-native resource files. These are generated by the Crowdin localisation tool.
Thanks again. Please let me know if you have any questions.
Thanks @AntonyCorbett Do you mind pointing me to the file or set of files to start from to begin to understand how images are processed in OnlyM. That might speed this up a bit for me. Thanks in advance!
@Notabela Please see below:
OnlyM.Core MediaProviderService
should be updated to include the SVG image type.
OnlyM ImageDisplayManager
contains the code that renders images in the Image
control. This is the standard WPF Image control (which doesn't support SVG files), so I would approach this by modifying the OnlyM.CoreSys GraphicUtils.InternalGetBitmapImage
method so that it recognises SVG content and converts it to a XAML-compatible BitmapImage.
There are some resources online that may help with the SVG to XAML conversion, e.g. https://github.com/BerndK/SvgToXaml
@Notabela I have implemented support for SVG in the latest pre-release. Sorry if this duplicates work you may have done.
@jstevensen Implemented in the latest pre-release.