Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

BW conversion with invert check
Started by kenk@iatricsys.com at 11-23-2007 11:32. Topic has 5 replies.

Print Search « Previous Thread Next Thread »
  11-23-2007, 11:32
kenk@iatricsys.com is not online. Last active: 11/27/2007 1:31:17 AM kenk@iatricsys.com

Not Ranked
Joined on 06-17-2003
Posts 3
BW conversion with invert check
Reply Quote

Hi,

I am using Lead Tools Raster Pro V13.

I am converting non Black/White images to Black/White. I then check if the image is inverted and correct it if so. The problem I have is the resulting image,inverted or not, is "blocky" or "pixelated". If I save it to file and then load it again, it looks great! How can I get the same results without saving to file and reloading?

Thanks.

Best regards,

Ken

Here is the code I use.

'Convert to BW

ctlLeadViewer.Grayscale 8
ctlLeadViewer.ColorRes 1, CRP_FIXEDPALETTE, CRD_NODITHERING, 0
LeadOLEColor = ctlLeadViewer.BitmapPalette(0)
If LeadOLEColor <> 0 Then
   'image inverted-swap palatte values
   ctlLeadViewer.BitmapPalette(1) = ctlLeadViewer.BitmapPalette(0)
   ctlLeadViewer.BitmapPalette(0) = 0
End If
ctlLeadViewer.PaintScaling = PAINTSCALING_RESAMPLE

'Save to file

    ctlLeadViewer.GetFileInfo pstrTempFile, pPage + 1, 0 'FILEINFO_TOTALPAGES
    ctlLeadViewer.SaveIFD = ctlLeadViewer.InfoIFD
    ctlLeadViewer.SavePage = 1
    ctlLeadViewer.Save pstrFileName, FILE_CCITT_GROUP4, ctlLeadViewer.BitmapBits, pintCompression, Save_Overwrite

ctlLeadViewer.SaveIFD = 0

Reload it

    ctlLeadSource.GetFileInfo pstrFileName, pPage + 1, 0
    ctlLeadSource.LoadIFD = ctlLeadSource.InfoIFD
    ctlLeadSource.Load pstrFileName, 0, pPage + 1, 1
    ctlLeadSource.LoadIFD = 0
    ctlLeadViewer.Bitmap = ctlLeadSource.Bitmap

The image looks great after reloading.

 


   Report 
  11-25-2007, 5:00
Maen Hasan is not online. Last active: 10/13/2008 7:35:45 AM Maen Hasan



Top 10 Posts
Joined on 08-05-2004
Posts 1,748
Re: BW conversion with invert check
Reply Quote
Hello,

What is the build number (file version) of the LEADTOOLS v13 DLLs that you use?

Can you please send me snapshot images that show the problem in the result image and how exactly do you expect it to appear?

Note: please put the images in a ZIP or RAR file and post it here.

Thanks,
Maen Badwan
LEADTOOLS Technical Support

   Report 
  11-26-2007, 20:50
kenk@iatricsys.com is not online. Last active: 11/27/2007 1:31:17 AM kenk@iatricsys.com

Not Ranked
Joined on 06-17-2003
Posts 3
BW conversion with invert check

Attachment: Images.zip
Reply Quote

Hi,

I am using Lead Tools V13.0.0.53

I have attached a zip file that contains the original bmp (Original.bmp). It is a 24bit True color image.Also I added a screen scrape(Converted1bit.bmp), that represents the results I get after using Lead.Grayscale and Lead.ColorRes.

If I simply reload the file after the conversion, as in my code above, the pixelization is gone and the image looks like the original....only it is now a 1 bit image, which is what I want.

Best regards,

Ken

Moderator: Please move this to the other post with the same name. I tried to reply to the other thread but it placed it here.


   Report 
  11-27-2007, 4:21
Maen Hasan is not online. Last active: 10/13/2008 7:35:45 AM Maen Hasan



Top 10 Posts
Joined on 08-05-2004
Posts 1,748
Re: BW conversion with invert check
Reply Quote
Hello,

To improve the display quality of image, after changing the image to 1-bit, try to BitonalScaling property to BITONALSCALING_SCALETOGRAY and repaint the image.
+----+
ctlLeadViewer.ColorRes 1, CRP_FIXEDPALETTE, CRD_NODITHERING, 0

ctlLeadViewer.BitonalScaling = BITONALSCALING_SCALETOGRAY
ctlLeadViewer.ForceRepaint
+----+

Please let me know if this helps.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
   Report 
  11-28-2007, 21:50
kenk@iatricsys.com is not online. Last active: 11/27/2007 1:31:17 AM kenk@iatricsys.com

Not Ranked
Joined on 06-17-2003
Posts 3
Re: BW conversion with invert check
Reply Quote

Hi Maen,

Sorry to say but that didn't have an effect.

I would guess the conversion samples the pixels color and determines whether to convert it to Black or White and then applies the dither method. I know I can choose different dither methods, but is there a way to adjust the threshhold used when converting to 1 bit?

Thanks.

Best regards,

Ken


   Report 
  11-29-2007, 4:43
Maen Hasan is not online. Last active: 10/13/2008 7:35:45 AM Maen Hasan



Top 10 Posts
Joined on 08-05-2004
Posts 1,748
Re: BW conversion with invert check
Reply Quote
Hello,

I checked your code with the BITONALSCALING_SCALETOGRAY option using LEADTOOLS v14.5 and the problem is not active. The image displays correctly using LEADTOOLS v14.5.

LEADTOOLS v13 is out of production and we no longer update or fix problems in this version.

If you would like, you can check the same issue using the evaluation version of LEADTOOLS v14.5 SDK. You can download the evaluation version directly by using the following URL:
http://www.leadtools.com/evaldownloads/v14/eval/LEADTOOLSEVAL.exe

Thanks,
Maen Badwan
LEADTOOLS Technical Support

   Report 
Post
LEAD Support Fo... » Developer » Color Conversio... » BW conversion with invert check

Powered by Community Server, by Telligent Systems