UIElement to PNG - Text slightly blurred - silverlight

I am using ImageTool's PNG encoder to create an image.
I have a Grid that contains multiple TextBlocks, each TextBlock contains dynamic text.
When I create a WriteableBitmap from the grid containing the TextBlocks, I then use ImageTool's encoder to convert the WriteableBitmap to a PNG image.
All works well, however, when I view the PNG image (am saving the file to the hard drive for testing purposes) - the text looks slightly blurred. Is this an issue with the encoder or the WriteableBitmap class? And - has anyone experienced this before and are there workarounds?
Thanks.

I'm a part of ImageTool project but I'm playing as a tester since I'm using this library in one of my project... If you can create a sample then you can probably show us so that we can test in our machine.
You can also try with Joe Stegman's encoder or fJCore JPEG encoder.

Related

How to Play Transparent background avi file in media element?

I have a video with transparent background in .avi format (Made from Adobe After Effects), but the transparent background appears black in mediaelement. Media Player has no background property also.
What should i use so that this media element plays the file and when placed on an image takes that image as its background. (No i cannot embed that image in the avi file as my image keeps changing).
*If my approach is wrong please let me know.
I'm afraid using the normal wpf media player this can't be done.
The mediaplayer ignores the transparent regions, even with video formats that accept it. From memory, i dont think AVI files support transparent regions. MOV files do.
Having said that, and although it could be a very complicated task, it may be possible to enhance the WPFMediaKit mediaplayer to do what you want.
http://wpfmediakit.codeplex.com/
J Morrill the author of wpfmediakit may be able to let you know if it is possible or not.
I might add that i got around this problem in a project once by using a sequence of .png files that played a short 10 second movie. Of course this is not an ideal solution, but it got me out of a jam
Another workaround is to use color keying - assing a color (or more colors) in your video, which you translate to the transparency by a WPF Effect(BitmapEffect or ShaderEffect).

In WPF, how to Convert a D3DImage to Bitmap?

I'm trying to paste images from an external source (Paint.NET in my test), but it gives a D3DImage which I don't know how to convert to Bitmap.
How to do that?
A D3DImage, although it is a strange beast, is an ImageSource, so you can use as the Source for an Image and an Image is a Visual so you can use RenderTargetBitmap on it. There is sample code in the RenderTargetBitmap documentation that actually copies the bitmap from the Visual to another Image on same page:
RenderTargetBitmap Class

How do I create a WPF Image control that sources its data from a JPEG I've read into memory?

For the images in my application, I have been setting the source property of my image to a JPEG file on disk but, as part of my next iteration, I want to test keeping them in memory for speed.
How do I tell the WPF Image control to get its information from an in-memory source rather than from a file?
Have a look at InteropBitmap and WriteableBitmap, two classes that inherit from BitmapSource that allow you to supply the pixels of the image from an array.
To create an InteropBitmap you use methods on the Imaging class like Imaging.CreateBitmapSourceFromMemorySection.

How to embed a png in an Adobe Illustrator or Expression Design file to create XAML

I have an AI file. I paste it into Expression Blend and then export the XAML for use in my WPF project. Works for most of my files, but some export the XAML plus a seperate png file. What can I do so that the png is embedded into the paths of my image and not a seperate image? Can it be done?
Checkout this page that describes converting raster graphics to vector and then XAML -
http://weblogs.asp.net/rrobbins/archive/2007/11/11/how-to-convert-raster-graphics-to-xaml.aspx
Another route that you could try is to use Expression Design to convert the .ai file.
(Please note that once you have Expression Design open, you need to create a new document before the File->Import menu item is even enabled.)
However, once you convert the .ai file with Expression Design, you will likely still have the problem of having some raster information in the .ai ... which as Terrapin already mentions is hard to convert to vector (and usually brings a high memory footprint to get even close to the quality of the raster image).
But to help you out there, Expression Design also comes with some ability to convert raster information into vector. If you select the image that you want to convert, just go to Object->Image->Auto Trace Image in order to convert it.
See this StackOverflow question for more info, but basically Microsoft allows you to download a trial that you can use for 90 days.
Hope that helps.
It sounds like the PNG that is generated is probably the raster part of your AI file, and it can't be converted to vector graphics. Are you importing PNGs, or JPGs, or another raster graphic into your AI file?
To convert raster images to vectorial images, I found Inkscape (free) to do an excellent job (comparable to VectorMagic, which is not free anymore by the way).
In Inkscape, import your image and use the Path/Trace Bitmap function. It has a lot of control.
Once you converted to a vectorial image, save it as a SVG. Then, using ViewerSvg, you can convert to XAML vector data. (Path & Canvas)

Convert an image to XAML?

Does anyone know of any way to convert a simple gif to xaml? E.G. A tool that would look at an image and create elipses, rectangles and paths based upon a gif / jpg / bitmap?
Inkscape can trace bitmaps, and can save directly to XAML. And, it happens to be free. I've used it to trace a lot of bitmaps and it's worked really well for me.
Illustrator has a trace tool which will do this
a cheaper option might be
http://vectormagic.com
it will export a svg that you should be able to convert to xaml
A combination of Vector Magic followed by ViewerSVG produces the best quality results for me.
With this online converter you can convert an image to SVG Format. then download Converted File and open it in a text File Editor then you can easily copy path data
image.online-convert

Resources