Good morning,
I'm using currently last version (12.1) of Imaging .NET SDK, modifying demo 'ImagingDemo.Net7', trying to draw some graphics on the image visualized on ImageViewer.
With both GdiGraphics and SkiaSharp at Graphics opening
DrawingEngine graphics = imageViewer1.Image.CreateDrawingEngine())
passing a not RGB image (i.e. Gray 8, Gray 16, ..), I get a
System.NotSupportedException: 'PixelFormat Gray8 is not supported by GdiGraphics / SkiaSharp.'
It seems that GdiGraphics and SkiaSharp are working only on RGB images.
Do you have some other demos or some suggestions on how to draw a simple rectangle?
Thanks in advance
DrawingEngine for not RGB images
Moderator: Alex
Re: DrawingEngine for not RGB images
Hello Marco,
System.Drawing.Graphics class allows to draw graphic primitives on RGB images only.
SkiaSharp drawing engine allows to draw graphic primitives on 32-bit RGB images only.
If you want to draw rectangle on image, please convert image to RGB image, draw rectangle, convert image to a palette image if necessary.
Or maybe do you want to draw rectangle over image in image viewer? If yes, you do not need to change image - please read about GraphicObjectTool class here: https://www.vintasoft.com/docs/vsimagin ... _Tool.html
Best regards, Alexander
System.Drawing.Graphics class allows to draw graphic primitives on RGB images only.
SkiaSharp drawing engine allows to draw graphic primitives on 32-bit RGB images only.
If you want to draw rectangle on image, please convert image to RGB image, draw rectangle, convert image to a palette image if necessary.
Or maybe do you want to draw rectangle over image in image viewer? If yes, you do not need to change image - please read about GraphicObjectTool class here: https://www.vintasoft.com/docs/vsimagin ... _Tool.html
Best regards, Alexander
-
- Posts: 9
- Joined: Mon Mar 13, 2023 11:19 am
Re: DrawingEngine for not RGB images
Thank you Alexander.
I need just to do some drawings over image in image viewer, so the "GraphicObjectTool" that you suggest is good.
What I realize is that it seems possible to select only 1 tool from the "visualToolToolsStrip", that means lose my drawings when a different tool is selected, changing zoom for example.
Is there a way to avoid it? How to select more than 1 Visual Tool at the same time?
I'm also trying to figure out how to customize the visualToolToolsStrip that is modified at runtime, but for me it is not clear yet.
I need just to do some drawings over image in image viewer, so the "GraphicObjectTool" that you suggest is good.
What I realize is that it seems possible to select only 1 tool from the "visualToolToolsStrip", that means lose my drawings when a different tool is selected, changing zoom for example.
Is there a way to avoid it? How to select more than 1 Visual Tool at the same time?
I'm also trying to figure out how to customize the visualToolToolsStrip that is modified at runtime, but for me it is not clear yet.
Re: DrawingEngine for not RGB images
Hello Marco,
If you want to use several visual tools at once, you need to place visual tools into composite visual tool. Please read about Vintasoft.Imaging.UI.VisualTools.CompositeVisualTool class here: https://www.vintasoft.com/docs/vsimagin ... _Tool.html
Best regards, Alexander
If you want to use several visual tools at once, you need to place visual tools into composite visual tool. Please read about Vintasoft.Imaging.UI.VisualTools.CompositeVisualTool class here: https://www.vintasoft.com/docs/vsimagin ... _Tool.html
Best regards, Alexander