Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, May 9, 2012 6:54:04 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

LEADTOOLS Shader Effects in Silverlight (such as ContrastAdjustEffect) affect on the display of the image. You can save the Silverlight image after applying LEADTOOLS Shader Effects by using the following code:
+---------------------------+
theViewer.Source = null;
theViewer.Source = RasterImageConverter.ConvertToSource(rasterImage.Clone(), ConvertToSourceOptions.None);
ContrastAdjustEffect effect = new ContrastAdjustEffect();
effect.Brightness = 0.0;
effect.Contrast = 1.2;
theViewer.ImageEffect = effect;

// We have a bitmap in the Image control, so we can do the following:
BitmapSource bitmap = (BitmapSource)theViewer.Source;

// To capture the output of the effect, we need to use a WritableBitmap
WriteableBitmap writeableBitmap = new WriteableBitmap((int)theViewer.ActualWidth, (int)theViewer.ActualHeight);

// Render the effect
writeableBitmap.Render(theViewer, null);
writeableBitmap.Invalidate();

// Now, save it as a png, must use LEADTOOLS
SaveFileDialog dialog = new SaveFileDialog();
if (dialog.ShowDialog() == true)
{
using (Stream stream = dialog.OpenFile())
{
RasterImage rasterImage1 = RasterImageConverter.ConvertFromSource(writeableBitmap, ConvertFromSourceOptions.UseWritableBitmap);
RasterCodecs codecs = new RasterCodecs();
codecs.Save(rasterImage1, stream, RasterImageFormat.Png, 0);
}
}
+---------------------------+

Maen Badwan
LEADTOOLS Technical Support
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.031 seconds.