Solved

Convert bmp to 1-bit (B & W)

Posted on 1998-04-07
7
579 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

773 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