Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic SaveToPng file size (Read 4631 times)
chiru29
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 35
Location: Hyderabad
Joined: Jul 16th, 2010
SaveToPng file size
Oct 8th, 2012 at 10:20am
Print Post  
Hi,
I'm using SaveToPng() method to save my diagram to file store. However even the simplest of drawings taking huge space in MB. I'm not sure if I did something wrong here, can you please advise?
Please find the sample code below

            SaveFileDialog saveFileDlg = new SaveFileDialog();
            saveFileDlg.DefaultFileName = "sample.png";
            if (saveFileDlg.ShowDialog() == true)
            {
                Stream fileStream = saveFileDlg.OpenFile();
                this.diagram.SaveToPng(fileStream);
                fileStream.Close();
            }

Thanks in advance.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SaveToPng file size
Reply #1 - Oct 8th, 2012 at 11:19am
Print Post  
Hi,

Check this thread:
http://mindfusion.eu/Forum/YaBB.pl?num=1328022990

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


I love YaBB 1G - SP1!

Posts: 35
Location: Hyderabad
Joined: Jul 16th, 2010
Re: SaveToPng file size
Reply #2 - Oct 8th, 2012 at 11:46am
Print Post  
Thanks for the reply.

I dont want to use any 3rd party tools, is there any other way of acheiving this?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SaveToPng file size
Reply #3 - Oct 8th, 2012 at 12:21pm
Print Post  
Then you will have to call Diagram.CreateImage() to get a WriteableBitmap representing the diagram, and create compressed image from the data in WriteableBitmap.Pixels yourself.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
donalmeida
Junior Member
**
Offline


Yay...

Posts: 65
Joined: Oct 6th, 2009
Re: SaveToPng file size
Reply #4 - Jan 3rd, 2013 at 4:24pm
Print Post  
I had a similar issue. and after trying a lot of code. I tried setting the bounds of the diagram to 0 like this  currentDiagram.Bounds = new Rect(0, 0, 0, 0); then saved the image  like the above code and then reset it back to the original bounds. I reduced my image side from 28 MB to 1.2 MB.

I hope this  helps...
  

Don Almeida.
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint