I'm drawing some lines in an InkCanvas which I'm converting to a BitmapImage. I want to merch this image with another BitmapImage, but I can't find any way to do this in UWP. Does anyone know a good way to do this?
I suggest you to use WriteableBitmap with WritieableBitmapEx instead of BitmapImage. Then simply use WriteableBitmap's new Blit() function with None as BlendMode and you should have the desired effect.
Related
I know SkiaSharp exists, but it is not supported in Xamarin.Forms.
Can I simply draw using 1x1 BoxViews? But I think drawing a signature (with touchevent) may impact performance. Is there any better option?
If you just want a signature, you can try to use https://github.com/xamarin/SignaturePad and create a custom Control that is using it. Or you can have a look at https://github.com/aritchie/acr-xamarin-forms that is basically a translation of the first one for Xamarin.Forms. Unfortunately it is outdated, but you could use it as a guideline for your own implementation.
I'd like to append a border (20px white) to an image, save as a new jpeg image (orginal image with a border), I don't know how do I start. Can anyone give me a direction or code example?
Thanks
You have two ways to do it:
On your UI, wrap the image with a Border element with the correct settings and use new WriteableBitmap(borderElement, null) to create a new WriteableBitmap which you can then save using the SaveJpeg extension method.
Your other option is to use the WriteableBitmapEx class library to graphically add the graphical elements you want.
I've used both. The advantages for (1) is that there's less hassle in the sense of adding a dependeny on another DLL. The advantage in (2) is that you don't need to mess with your UI to create the image.
Is there a javascript library to draw images directly in the browser and save them to png or jpeg?
I want to use an alternative to services like aviary.com, pixlr.com and sumopaint.com and dont want to rely on third-party services and apis like these ones.
Is processingjs the right solution? I want a solution that works everywhere so please no nodejs and so on.
I need tools like a brush, paintbrush, pencil, layers, filters and so on - just like the real photoshop.
You could also draw all sorts of images and animations using http://paperjs.org/
Then you can save them using straightforward JS:
var canvas = document.getElementById("my_canvas_element");
var imageToExport = canvas.toDataURL("image/jpeg");
document.write('<img src="'+img+'"/>');
Try processingjs
For image saving, just use data-urls:
http://en.wikipedia.org/wiki/Data_URI_scheme
Get image data in JavaScript?
I am looking to find a way to create a raster image of a canvas in windows phone 7. I want to be able to either save the image or share it (MMS, email, ect). I am just starting to learn C# and about Silverlight, so this is uncharted waters for me.
Thank you,
Doc Haven
I am not sure if this is the best way to go about this, but this is how I have found my solution to my own problem:
One of the constructors for the WriteableBitmap class allows you to pass it a UIElement and a Transform such that the call new WriteableBitmap(canvas, null); would create a WriteableBitmap from the Canvas. I later set my Image source to that WriteableBitmap.
I do hope that this helps anyone else that may come into this issue in the future!
Thank you,
Doc Haven
checkout the RenderTargetBitmap class, you can create a bitmap image of any visual element then do what you want with it.
Seen a good charts plugin I want to use:
http://www.jqplot.com/tests/stackedTests.php
But for my visitors, they may want to save this as an image (via right click, copy as image menu item) or alternatively a button that says save as image or something similar.
So is it possible to save the canvas in any given state as an image file?
I think toDataURL could help you :)
If you are willing to use a pre-made library, you can try using Canvas2Image.
Otherwise there are a few Canvas methods that Canvas2Image wraps around and explain in more detail in the above site, namely the toDataURL method in the Canvas object that returns the data base64 encoded in the image format that you require. It's not 100% cross-browser, I think, but it's the "right" way of getting it.