Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic SaveToPNG image size (Read 4318 times)
binuvc
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 46
Joined: Nov 7th, 2011
SaveToPNG image size
Jan 31st, 2012 at 3:16pm
Print Post  
Hi,

The size of the png stream obtained on invoking SaveToPNG is increasing to more than 8 mb and sending the image to serverside is becoming an issue.

Do we have any compressioin routines using which we can reduce the size?

Please advice.

Thanks
BinuVC
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SaveToPNG image size
Reply #1 - Jan 31st, 2012 at 5:46pm
Print Post  
Hi,

There are no image encoders provided with the Silverlight runtime and there's no built-in compression in DiagramLite. You will have to use a third party library to create compressed images. E.g. the code below creates a jpeg image using the Silverlight ImageTools library from http://imagetools.codeplex.com/:

Code
Select All
private void OnExport(object sender, RoutedEventArgs e)
{
	var bitmap = diagram.CreateImage();
	var image = ImageExtensions.ToImage(bitmap);
	var dlg = new SaveFileDialog();
	dlg.DefaultExt = ".jpg";
	if (dlg.ShowDialog() == true)
	{
		var stream = dlg.OpenFile();
		var encoder = new JpegEncoder();
		encoder.Encode(image, stream);
		stream.Close();
	}
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
binuvc
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 46
Joined: Nov 7th, 2011
Re: SaveToPNG image size
Reply #2 - Feb 1st, 2012 at 4:22am
Print Post  
Thanks !!

BinuVC
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint