We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

High Resolution Images

Hi, Could you please tell me how insert high resolution images into the diagram control so that it maintains the resolution as required for high quality printing. So for example, if I had a 600dpi image that is 1200 pixels by 1200 pixels the image that is shown in the diagram control would be 2 inches by 2 inches and not 12.5 inches by 12.5 inches caused by the 96dpi. Thanks Chris

4 Replies

AD Administrator Syncfusion Team July 21, 2005 07:04 PM UTC

Hi Chris, Thank you for having raised this issue. We spent a good bit of time looking into the problem, and it looks like we sill have to provide an option in the Syncfusion.Windows.Forms.Diagram.BitmapNode class that will use the image resolution for determining the node size, and also retains the original resolution when rendering the image. We will do our best to implement this functionality in a future update of the product. For the time being, you can workaround the condition by creating and assigning to your BitmapNode an image that uses the correct resolution and size. The following code shows an approach that can be used, Image img = Image.FromFile(sourceFile); SizeF displaysize = new SizeF((img.Width/img.HorizontalResolution)*96, (img.Height/img.VerticalResolution)*96); MemoryStream memstream = new MemoryStream(); img.Save(memstream, System.Drawing.Imaging.ImageFormat.Bmp); Bitmap bmp = new Bitmap(memstream); memstream.Close(); img.Dispose(); BitmapNode bmpnode = new BitmapNode(bmp, new RectangleF(0,0,displaysize.Width,displaysize.Height)); InsertNodesCmd inscmd = new InsertNodesCmd(); inscmd.Nodes.Add(bmpnode); inscmd.Location = new PointF(20,20); this.diagramComponent.Controller.ExecuteCommand(inscmd); I hope this helps. Please let me know if the code requires further revision. Regards, Prakash Surendra Syncfusion Inc.,


CS Chris Santer July 25, 2005 03:49 PM UTC

Thank you, this works well. >Hi Chris, > >Thank you for having raised this issue. We spent a good bit of time looking into the problem, and it looks like we sill have to provide an option in the Syncfusion.Windows.Forms.Diagram.BitmapNode class that will use the image resolution for determining the node size, and also retains the original resolution when rendering the image. We will do our best to implement this functionality in a future update of the product. > >For the time being, you can workaround the condition by creating and assigning to your BitmapNode an image that uses the correct resolution and size. The following code shows an approach that can be used, > >Image img = Image.FromFile(sourceFile); >SizeF displaysize = new SizeF((img.Width/img.HorizontalResolution)*96, (img.Height/img.VerticalResolution)*96); >MemoryStream memstream = new MemoryStream(); >img.Save(memstream, System.Drawing.Imaging.ImageFormat.Bmp); >Bitmap bmp = new Bitmap(memstream); >memstream.Close(); >img.Dispose(); > >BitmapNode bmpnode = new BitmapNode(bmp, new RectangleF(0,0,displaysize.Width,displaysize.Height)); >InsertNodesCmd inscmd = new InsertNodesCmd(); >inscmd.Nodes.Add(bmpnode); >inscmd.Location = new PointF(20,20); > >this.diagramComponent.Controller.ExecuteCommand(inscmd); > >I hope this helps. Please let me know if the code requires further revision. > >Regards, >Prakash Surendra >Syncfusion Inc.,


AD Administrator Syncfusion Team July 26, 2005 02:39 PM UTC

Chris, We have made the necessary changes to the ImageNode related classes. Starting with the next version of the product, the BitmapTool will have a SizeToImageDPI property that you can set during initialization to size the node using the image resolution. Thank you for having brought this issue to our attention. Regards, Prakash Surendra Syncfusion Inc.,


AD Administrator Syncfusion Team July 26, 2005 03:10 PM UTC

Thats great, that will be good for me too.

Loader.
Live Chat Icon For mobile
Up arrow icon