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 : Friday, May 12, 2006 6:18:01 AM(UTC)

email  
email

Groups: Registered
Posts: 4


Hello --

I am using LT 14.1.0.14 and trying to convert a RasterImage to a System.Drawing.Image type (GDI+ bitmap).  I have tried both ChangeToGdiPlusImage() and ConvertToGdiPlusImage() with inconsistent results.  ChangeToGdiPlusImage() seems more reliable, but I still occasionally get an exception "Image is not GDI+ compatible".  I have several related questions:

1.  What is the difference between ChangeToGdiPlusImage() and ConvertToGdiPlusImage().  Which one should I use?
2.  What does the ChangeToGdiPlusImageFlags.ForceChange flag do?  The transform still fails sometimes when I use this flag.
3.  What could cause the exception "Image is not GDI+ compatible" when I call ChangeToGdiPlusImage()?  I do not receive the exception consistently even with the same type of source image data.
4.  Is there example code somewhere that illustrates how to convert a RasterImage to an Image?
5.  I have OLD help files.  How do I get the latest help?


Thanks,
Tom
 

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.

#2 Posted : Tuesday, May 16, 2006 5:28:48 AM(UTC)

Bashar  
Guest

Groups: Guests
Posts: 3,040

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

Tom,

1) The difference between them is the flag that ChangeToGdiPlusImage takes.

2) This flag should force the image to be GDI+ compatible if it isn't.


3) It seems that the image is not GDI+ compatible, but using the
ForceChange flag should force the conversion.  Do you get this
error consistently with specific images or do you get it intermittently
with the same image?  Try calling TestGdiPlusCompatible to see why the image is not GDI+ compatible.

4) I do not have any sample code at hand, but you can take a look at the samples in the documentation of both methods.


5) I think you have another on this issue.  Please download the
latest setup for v14 .NET.  If you do not have the download
instructions, then please send your serial number to "support@leadtools.com".


 
#3 Posted : Wednesday, May 17, 2006 7:28:19 AM(UTC)

email  
email

Groups: Registered
Posts: 4


Bashar --

I get this failure consistently with the same image.  TestGdiPlusCompatible() reports back a reason of "Data".  I am attempting to convert large images, sometimes up to 10,000 x 10,000 pixels.  However, sometimes the error occurs for smaller-sized images also.  I noticed that when the operation fails, the source image has properties IsDiskMemory = true and IsManagedMemory = false.  It appears that when the source image was originally created, LT could not get enough memory from .NET and resorted to creating an unmanaged image stored on disk instead of RAM.

What are your thoughts on what is happening?

Thanks,
Tom
 
#4 Posted : Sunday, May 21, 2006 6:30:47 AM(UTC)

Bashar  
Guest

Groups: Guests
Posts: 3,040

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

The fact that sDiskMemory = true and IsManagedMemory = false is the cause of the problem; disk-based
images are not GDI+ compatible.  Try cloning the image using the
CloneCommand class, and specifying RasterMemoryFlags.Managed for the CreateFlags.

 
#5 Posted : Monday, December 20, 2010 4:59:05 AM(UTC)
suraj.coastis

Groups: Registered
Posts: 9


In Leadtools 17.0. There's no ConvertToGdiPlusImage method provided for RasterImage class. So how can we convert a RasterImage object to System.Drawing.Image object?
 
#6 Posted : Monday, December 20, 2010 6:39:11 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,040

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

This function has changed in LEADTOOLS v17. This information is available in the help topic "Leadtools Assembly Changes" in our .NET help file. You can also check this topic on this page:
http://www.leadtools.com/help/leadtools/v17/dh/to/Leadtools.Topics.Leadtools~Topics.LeadtoolsVersionChanges.html

To convert the LEADTOOLS RasterImage to GDI+ image objects, use the RasterImageConverter.ConvertToImage() method. For details and code sample, please see the RasterImageConverter Class help topic. Also available on this page:
http://www.leadtools.com/Help/LEADTOOLS/v17/DH/ld/leadtools.drawing~leadtools.drawing.rasterimageconverter.html
 
#7 Posted : Thursday, December 23, 2010 8:37:14 AM(UTC)

Kousay  
Kousay

Groups: Registered
Posts: 8


Hello,

The main difference is ConvertToImage creates a copy of the RasterImage and no not share the same image data.

ChangeToImage will return a GDI+ image that shares the same memory for the image data as the source RasterImage. If you change one (GetPixel/SetPixel, flip, etc) the other will change too.

Naturally, ChangeToImage require the RasterImage to be of a format comaptible with GDI+ (LEAD supports many more bits/pixel such as grayscale, color order, and many more features than GDI+).
 
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-2020, Yet Another Forum.NET
This page was generated in 0.206 seconds.