bitmap

C# - How to convert an Image into an 8-bit color Image?

I need to convert a PNG Image loaded from a file into an 8 bit-per-pixel byte array used by another device (embedded programming). I'm copying over pixel by pixel into a new Image created with a 16-bit color - Format16bppRgb565, but I need Format8bpp, which is not present in the .NET Framework. (I cannot use Format8bppIndexed since the ...

C# - Copy an Image into an 8-bit Indexed Image

I want to create an 8-bit indexed image from a regular 32-bit Image object. Bitmap img = new Bitmap(imgPath); // 32-bit Bitmap img8bit = new Bitmap(imgW, imgH, Format8bppIndexed); // 8-bit // copy img to img8bit -- HOW? img8bit.Save(imgNewPath, ImageFormat.Png); I cannot use SetPixel to copy it over pixel-by-pixel since Graphics doe...

How do disable a SimpleButton including changing it's appearance

Here is the premise: I have 10 buttons each with on normal state image (buttonX.png) and a mouseover state (buttonXglow.png). The buttons are created manually in flash, but referenced in my as3 main class. I need to add different states to the buttons. I want do the following: mark on of the buttons as selected, e.g. show it with the...

Rendering form to bitmap

I would like to render Form to bitmap... Is it possible in .net 2.0? ...

Why doesn't FastBitmap get garbage collected?

So I've finally located a problem I have with growing memory consumption. It's the class below, which for some reason doesn't get garbage collected. What would be the problem? The idea of the FastBitmap class is to lock the bitmap data of a bitmap image once to avoid locking/unlocking on each call to GetPixel/SetPixel. public unsafe cl...

Manage rotated moving raster map

Hi, My application present a (raster) moving map. I need to be able to show the map rotated base on any given angle. The program is currently in VC++/MFC but the problem is generic. I have a source bitmap (CBitmap or HBITMAP) and draw it to the device context (CDC) using StretchBlt. While this works fast and smooth for angle=0 (and the u...

How to represent binary transparency?

Lately I've been interested in representing uncompressed bitmaps in memory. However, one thing I'm not sure how to implement properly is binary transparency. E.g., I start out with something like this: struct RGBPixel { uint8_t red; uint8_t green; uint8_t blue; }; struct bitmap { struct RGBPixel *data; size_t width; size_t height...

Graphics.DrawImage Doesn't Always Paint The Whole Bitmap?

I have run into a strange problem when using Graphics.DrawImage. When using e.Graphics.DrawImage(Image, Point) in OnPaint to paint a bitmap 'buffer' on the control, it appears that parts of the image are omitted. The buffer is populated in a helper method which draws directly onto the Bitmap using a Graphics constructed from it. Wh...

How to detect and correct broken lines or shapes in a bitmap?

I want to find an algorithm which can find broken lines or shapes in a bitmap. consider a situation in which I have a bitmap with just two colors, back and white ( Images used in coloring books), there are some curves and lines which should be connected to each other, but due to some scanning errors, white bits sit instead of black ones....

Bitmap (of a signature) comparison in c#

We have a for fun project which require us to compare two black and white bitmaps of two signature and say whether they are the same persons signature. As this is just two loaded bitmaps rather than data captured from a tablet the approach is going to be a little different to normal signature recognition. I am thinking it would require...

Blackberry app, how to add an image on top of another image file?

Hello all, I'm trying to develop a small map-like application for blackberry. I need to know how can I position a small image onto another much larger image. The larger image is like a map, I'll need to use the small the image to pin point a specific position on the map. So the smaller image should overlay on top of the larger image....

Convert image to 1 bpp bitmap in .net compact framework

I have an image of a signature I am trying to save as 1 bpp bitmap to save file space. The full .NET Framework has the enum PixelFormat.Format1bppIndexed, but the .NET Compact Framework does not supported it. Has any one discovered a way to accomplish this in Windows Mobile? ...

Algorithm to reduce image to rectangles?

I'm attempting to create pretty large bitmaps in a C# application (6000x6000, though most is transparent) and need to draw them to a specific output API which only supports drawing rectangles. Now, I'm wondering if anyone has an algorithm to reduce a bitmap to a series of filled rectangles of similarly-colored bitmaps; since drawing eve...

as3 copy custom shape out of bitmap

So, I have bitmapA which is rectangular. I have a crop area I want to copy... However, the bitmap is at an angle from the crop. How do I copy a section from a bitmap that isn't a rectangle laid outon the x, y, axis?? Or copy custom shape???? Thanks ...

How can I create bitmaps (in C)?

I am wondering how I can both import and export bitmaps to and from C. I'm basically lost on where to begin. ...

Won't draw rectangle

I am creating a rectangle as a custom control object that is placed within a Panel control. The control rectangle is created and evidenced by the Panel's Paint event: void myPanel_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; foreach(ControlItem item in controls) g.DrawRectangle(new Pen(Brushes.Blue), new Rectan...

BitmapData of a masked image in ActionScript 3 (AS3)

Hello all, I am trying to take a snapshot of the masked region of an image... so, I load my image then perform the following functions: private function manageLoadedImage(e:Event):void { _bitdata = e.currentTarget.content; // get the bitmap _bithold.addChild( _bitdata ); // add the bitmap to a sprite on the stage _bithold...

WPF bitmap editor

Is there any opensource library/WPF Control that can act as bitmap editor (e.g. just like old good MS Paint)? Or some example for starting point? To be clear — I'm looking for a library (or something), that can be used inside my application. Any other ideas are wellcome. ...

Serialize a Bitmap in C#/.NET to XML

I want to XML-Serialize a complex type (class), that has a property of type System.Drawing.Bitmap among others. /// <summary> /// Gets or sets the large icon, a 32x32 pixel image representing this face. /// </summary> /// <value>The large icon.</value> public Bitmap LargeIcon { get; set; } I now have found out tha...

Combining (and converting) TIFF separations into 1 bitmap in C#

Hi, is there a simple way to take a number of 1-bit TIFF files (say, 4 for CMYK) and convert it into one contone RGB bitmap? This problem has me stumped.. Thanks.. ...