Click here to Skip to main content
15,891,936 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to save an image in picturebox with binary format(1bpp) but VB.net doesn't support this. What do I do? Please help me in coding this.
VB
If SaveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
    ptr2.Image.Save(SaveFileDialog1.FileName)
    mnuclose.Enabled = True
End If
Posted
Updated 27-Mar-11 12:01pm
v3
Comments
Аslam Iqbal 27-Mar-11 7:00am    
Edited for <pre="vb"> tag.
What is the error? This code works fine.
Sergey Alexandrovich Kryukov 27-Mar-11 15:43pm    
OP commented: "but the format is not binary!"

@Smile.Avatar: all files are always binary. When you understand this first, you will be able to understand what is the text file, etc. No sooner.
--SA
Sergey Alexandrovich Kryukov 27-Mar-11 16:11pm    
Aslam, I received you "????" somewhere, probably related to deleted post.
I'm assuming it was addressed to OP. That was my reaction, too.
I think this is about confusion with the binary.
--SA
Аslam Iqbal 27-Mar-11 16:20pm    
yep
Sergey Alexandrovich Kryukov 27-Mar-11 16:22pm    
Aslam, I finally noticed "1bpp" and gave a big and non-trivial Answer (because the problem is non-trivial). I don't thing it's of any use to OP, because of apparent OP's level, but -- please take a look.
--SA

1 solution

Binary image format has nothing to do with "1bpp" (one bit per pixel) — all formats a binary! You're just confused.

If you really need one bit per pixel, the problem is not fully defined, as this is the operation with data loss, so it should be defined what part if information you agree to loose or what are the criteria to classify a pixel into 100% white or 100% black.

This is not a trivial task. One possible meaning of it would be the "posterization" into two tones. A low-quality solution is discrimination of the pixel by some criteria as "brightness", so there can be many different solution (depending on selected level). A high-quality solution is really a complex task related to image recognition. You need to learn some basics of image recognition to understand this. Image recognition is a whole branch of science.

—SA
 
Share this answer
 
v2
Comments
Manfred Rudolf Bihy 27-Mar-11 18:03pm    
Looks like you're onto the right track! 5+
Sergey Alexandrovich Kryukov 27-Mar-11 19:01pm    
Thank you, Manfred.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900