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, November 23, 2007 6:27:29 AM(UTC)

kenk  
kenk

Groups: Registered
Posts: 3


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.

 

 

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 : Saturday, November 24, 2007 11:55:39 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

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
 
#3 Posted : Monday, November 26, 2007 3:45:45 PM(UTC)

kenk  
kenk

Groups: Registered
Posts: 3


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.

File Attachment(s):
Images.zip (87kb) downloaded 21 time(s).
 
#4 Posted : Monday, November 26, 2007 11:16:13 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

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
 
#5 Posted : Wednesday, November 28, 2007 4:45:31 PM(UTC)

kenk  
kenk

Groups: Registered
Posts: 3


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

 
#6 Posted : Wednesday, November 28, 2007 11:38:54 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

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
 
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-2024, Yet Another Forum.NET
This page was generated in 0.087 seconds.