• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 575
  • Last Modified:

Flatten image using c#

I have an image that I have to flatten using c#.  How can I do it Is it possible?  The image is a bitmap.
0
dbdp
Asked:
dbdp
  • 3
  • 3
1 Solution
 
Bob LearnedCommented:
I need to make sure what you mean by "flatten".

Bob
0
 
dbdpAuthor Commented:
I will try and explain - basically I am creating a barcode by "drawing"  the lines - when I save this barcode as a bitmap - the only thing being saved are the lines - i.e. it is not saved against a white background.  I basically need to add the white background.
0
 
Babycorn-StarfishCommented:
Hi,

what colour is the background? black?

BCS
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Babycorn-StarfishCommented:
Hi again,

how are you setting up your image? Have you tried firstly drawing a white rectangle the size of the image and then drawing onto the now white image?
0
 
dbdpAuthor Commented:
Well, transparent - in actual fact there isn't a background and that's my problem
0
 
Babycorn-StarfishCommented:
My crude example:

            Bitmap b = new Bitmap(100, 100);
            Graphics g = Graphics.FromImage(b);
            g.FillRectangle(Brushes.White, new Rectangle(0, 0, b.Width, b.Height));
            g.DrawLine(Pens.Black, new Point(10, 0), new Point(10, 100));
            g.DrawLine(Pens.Black, new Point(15, 0), new Point(15, 100));
            g.DrawLine(Pens.Black, new Point(50, 0), new Point(50, 100));
            g.DrawLine(Pens.Black, new Point(55, 0), new Point(55, 100));
            g.DrawLine(Pens.Black, new Point(80, 0), new Point(80, 100));

it'd be better to setup the Bitmap a bit more precisely, setting pixel format etc.
0
 
dbdpAuthor Commented:
Full Marks to you my friend

Thank You
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now