Solved

Convert bmp to 1-bit (B & W)

Posted on 1998-04-07
7
556 Views
Last Modified: 2012-01-15
I have an image on my picture box and I need to save it to a file as a bmp.  I used the "SavePicture" Statement.  However, I need it to be saved as 1-bit (B & W) format.  How do I code this?
0
Comment
Question by:janim
7 Comments
 
LVL 3

Expert Comment

by:byang
ID: 1460646
Don't know how to do this in VB. But you can easily do this using windows API: create an HDC, select a mono HBITMAP into it, then draw your bitmap onto the HDC. Now your HBITMAP contains a black-and-white rending or your image.
0
 
LVL 1

Expert Comment

by:MAVERICK
ID: 1460647
I downloaded an image converter OCX, I will check it out. Is the .BMP in a file (assuming it is!) or is it generated by some code somewhere. If an OCX for the job is what u want then leave a comment.
0
 

Author Comment

by:janim
ID: 1460648
Does this OCX convert bmp files to 1-bit format?  Does this OCX  must be paid for?  Can I run it for FREE and with NO time limit (meaning the control is not limited for a couple of days only).  If so, I would need it.  Thanks in advance.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 45

Expert Comment

by:aikimark
ID: 1460649
You could convert the picture yourself with VB code before converting it.  Change the scalemode to Pixel and use a nested loop to inspect each pixel and change it to black or white.
for Hvar = 1 to picture1.scaleheight
   for Vvar=1 to picture1.scalewidth
     if Picture1.Point(Hvar,Vvar) > BlackCutOffValue then
        Picture1.Pset(HVar,Vvar, vbblack)
     else
        Picture1.Pset(HVar,Vvar, vbwhite)
     endif
   next
next

You will need to double-check my syntax.
0
 

Author Comment

by:janim
ID: 1460650
I need to save the picture as 1-bit format... my picture is already in B&W so I don't need to convert each pixel to B&W.
0
 

Author Comment

by:janim
ID: 1460651
HELP URGENT!!!  How can I convert my picture to 1-bit format using VB?
0
 

Accepted Solution

by:
qhenry earned 50 total points
ID: 1460652
I bought an OCX from a company call LeadTools which can do this.

disclaimer: I am not paid to recommend this product nor do I accept any responsibility for it's appropriatness for the given task.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now