I have a client that has houndreds of media files uploaded, all SVG, that we now need in png or jpg format (because we're sending these files to an iOS app and apperantly SVG:s in iOS apps doesn't play well). The client doesn't want to manually upload an png representation of every image, so the feature request for some sort of converter has been asked for.
I'm open for any ideas! Runtime converting or physicly saving a png image would also work, however that might add extra work since the client would need to update 2 media items if he wants to change a image.
Note: I dont want to replace the SVG file, since we still need it. I just want a png representation of the media item as well.
What I would consider is some kind of rasterizing library for SVG. If you have code that can convert an SVG to a bitmapped format, you can easily create an imageProcessor plugin which adds SVG as a recognized image format.
Thank you Damiaan! Yes I have the code for converting a svg to bitmap now, so I'll have a look at your plugin approach. I'll make sure to share my findings! Thanks again!
Convert Media item SVG to png/jpg/x
As the title reads, has anyone done this?
Background:
I have a client that has houndreds of media files uploaded, all SVG, that we now need in png or jpg format (because we're sending these files to an iOS app and apperantly SVG:s in iOS apps doesn't play well). The client doesn't want to manually upload an png representation of every image, so the feature request for some sort of converter has been asked for.
I'm open for any ideas! Runtime converting or physicly saving a png image would also work, however that might add extra work since the client would need to update 2 media items if he wants to change a image.
Note: I dont want to replace the SVG file, since we still need it. I just want a png representation of the media item as well.
Thanks in advance!
What I would consider is some kind of rasterizing library for SVG. If you have code that can convert an SVG to a bitmapped format, you can easily create an imageProcessor plugin which adds SVG as a recognized image format.
I have done the same for reading in a PDF and show (the first page) as a PNG or JPEG. You can find the example here: https://github.com/dampee/ImageProcessor.Plugins.Pdf/
Thank you Damiaan! Yes I have the code for converting a svg to bitmap now, so I'll have a look at your plugin approach. I'll make sure to share my findings! Thanks again!
is working on a reply...