Solved

Convert bmp to 1-bit (B & W)

Posted on 1998-04-07
7
584 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

828 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