I have a large number of svg files (over 1000) that have keyframe animations included in the CSS. Ultimately I want to be able to display these in an android app.
I looked into using android vectordrawable among other solutions but that will only display the image from path data and wont be feasible to try add animations to every file.
I have have also tried converting to png using http://www.codeplex.com/svg in c#, again the png file does not include the animation.
You can use a Webview to display your svg.
here is a post that can help .svg file as object in HTML
Related
Project Information : .NETCore v3.1 - IText7 v7.1.11
We have a PDF Document builder library created by IText7 nuget package, where we can dynamically building large PDF files for our customers.
Normally we are working with .jpg format but a new feature is added to our online side which is we have started to work with also interactive SVG files with hotspots integrated to our UI.
So, when our application builds a PDF Document it also needs to import those SVG files, we can use it by:
var image = SvgConverter.ConvertToImage(
new FileStream(imagePath, FileMode.Open, FileAccess.Read), pdfDocument);
The Original File (I can't upload a SVG so I am uploading as jpg but this is not important because I just want to show the line thickness):
Output is shown below, as you can see on the left side the lines become very thick and parts are not shown as expected.
Steps:
SvgConverter.DrawOnCanvas(svgStream, pdfCanvas);
SvgConverter.DrawOnDocument(svgStream, pdfDocument);
SvgConverter.DrawOnPage(svgStream, pdfPage);
SvgConverter.ConvertToXObject(svgStream, pdfDocument);
SvgConverter.ConvertToImage(svgStream, pdfDocument);
I have tried them all but results are same for all.
Questions:
PDF and SVG files are vectors, so can't we use them as integrated through IText, why should we need to convert it to a Raster? Why do we need a converter?
Is there a way to decrease thickness or a way to not to lose image quality?
Thank you for your time!
When you invoke SvgConverter.ConvertToImage or SvgConverter.ConvertToXObject, your SVG is not converted into a raster image - it still remains a vector image. So you can use the integrated SVG converter workflow and you are in fact using it with the SvgConverter. The converter is needed to process SVG file format into more PDF-specific structures, so it performs some conversion because PDF does not support SVG directly. This is not vector -> raster conversion though.
Regarding the problem with the line thickness, first think you should do is to try with the latest version - as far as I see you are trying with 7.1.11 while it's dated back to around a year and 7.1.15 is out already. If the problem persists then it's a bug in the SVG support in iText and you can try to minimize the SVG file to see if there is a workaround to achieve proper conversion until the bug is fixed for your case and/or report the problem to iText (StackOverflow is not the right place to report bugs).
Is there a way to display an SVG image (from a URL) in a xaml Image control in a UWP app
e.g.
<Image Source={Binding image_source}>
Where image_source is an absolute path to an image. Where the image is either png or svg format.
My solution works as expected with any common graphics format (jpg, png, gif) but displays nothing when the graphic is svg format.
I've seen loads of articles about converting the svg to something else, but the information comes from a web service that is not mine and use by others I would suspect. changing images on mass to png or something else I doubt would be an option.
In my application the Image is within a listView.
I've seen articles about converters and built in support for svg but none of them seem to work. I have yet to find any article here or anywhere with someone that has a working solution other than manually converting files (not an option)
Any help would be much appreciated.
UWP supports SVG natively and your solution should work. I guess the issue in your case is due to scaling. Make sure your graphics image has not scaled out of boundaries and you only see transparent part of it. You might try testing other SVG files to confirm that and play with size and SVG ViewBox attribute.
I am developing an android application and I have to display images in it. This image is uploaded from a c# application and I need to retrieve it to android client.
I am trying by loading the image into the DataBase and retrieveing it from android, but this takes much memory and I need a better way to do it.
This c# application is allocated into the server so maybe a good way is to store the images and access to the path from the android client, but is it possible to public an image in my server?
Further, which one you think is the best way to do it?
Thank you.
If I understand you correctly: You upload a picture using a C# program which stores the image (as binary data) in the database?
I would recommend to store the image on the filesystem and the (relative) path to the image in the database. Your Android clients get the URL of the picture and can download and display the image.
There are (very good) Android libraries for displaying images from URLs. Take a look at this library: Android-Universal-Image-Loader.
I will recommend you to store image file to server, and add its path to database.
The easiest ways to display image in your android app is using Picasso Library.
Download Picasso library from here
Add it to your build path. Import this library to your code file.
For loading image from web url:
String url = "http://example.com/image.png"
Picasso.with(getApplicationContext()).load(url).into(imageView);
For loading image from drawable:
Picasso.with(getApplicationContext()).load(R.drawable.imageFile).into(imageView);
Here, imageView is the name of variable you are using to represent ImageView. Eg.
ImageView imageView = (ImageView) findViewById(R.id.ImageView1);
To use Picasso with ImageButton, change imageView variable to imageButton variable
ImageButton imageButton = (ImageButton)findViewById(R.id.imageButton);
I'm trying to figure out a way to embed an image into a file in c#.
What I'm doing is to create a file with text inside of it (it uses XML) , and I want a quite big image embedded into it which I then can read from the file along with the XML.
But how do I do that?
I can't put an image file along with the file since the file may be used on different computers and I don't want 100's of image files laying around with the files.
Any ideas would be appreciated!
I have swf file's that's contains 2D images (here one of them: http://mapviewer.ru/img/tramvay/depo_d.swf )
I need draw this image (like seen in my browser), to bitmap.
Maybe i need convert this file to image (png, jpg)? No matter how, but it should be done programmatically.
Updated
Have you tried to look at this library ?
There are no embedded images inside the SWF file, only Vector shapes, which means you would need to both parse the SWF and render the data that is inside, so taking a screenshot of it is probably your best option. There are a lot of ways of doing this, but you could simply load the Flash Active-x in your application and take a screenshot. Here's how to load the SWF : Displaying Flash content in a C# WinForms application