Get Black Pixels of Writablebitmap using c# WP8.1 Silverlight - c#

I have a black & white writable bitmap.
What I would like to do is get all the pixels that have black color and I also want their location in form of coordinates e.g. inside arrays x[] and y[].
How can search pixels in an image in c#?

Related

C# How to create Color spectrum (bitmap)

How can I create a bitmap that looks something like this?
Rectangle picture. Bottom is for dark colors. Top is for bright colors. Colors are changing from left to right.
I need to create my own color spectrum bitmap because (external)image files are often compressed and not showing the correct colors in particular pixels.

How to draw half a pixel in C#?

I work with bitmap images in pictureBoxes, and color some pixels. I wonder if it is possible to fill just half of pixel? If yes, how to perform it in C# ?
You can't set color of just half of a pixel in bitmap.
You may be looking for sub-pixel rendering where RGB colors of individual pixels on a LCD screen are adjusted separately or anti-aliasing where the color of pixels of single object essentially bleeds to nearby pixels to provide smoother edges.

Make a WriteableBitmap Transparent in Windows Phone 8.1 C# WinRT Programmatically

Is it possible to add transparency to a WriteableBitmap in Windows Phone 8.1 using C# / WinRT programmatically?
I've referenced the WriteableBitmapEx library in my project for image resizing and blitting, which is quite useful, and it could also possibly help with adding transparency or alpha channels/layers, but the documentation is not very thorough.
It might be better to have a method without using the WriteableBitmapEx library to achieve this, but whatever works... I've been searching this for a while and there's not much information on a basic solution.
The idea is that a user can select an image or graphic, and pin it to their start screen, and the app would make the background color transparent...probably white or black, or even by using the first X/Y coordinate color of the image's background.
Have you tried using the transparent colour with your WriteableBitmapEx? For example to clear the entire bitmap use:
writeableBitmap = new WriteableBitmap(200, 200, 96, 96, PixelFormats.Bgra32, null);
writeableBitmap.Clear(Colors.Transparent);
If you want to edit specific pixels yourself - you need to access the PixelBuffer property. I'm sure WriteableBitmapEx does it all the time. So does my toolkit here. I can't recall the pixel format right now, but I think it's like ARGB or P-ARGB? I'm likely confused here, but basically your pixel buffer is an array that has data for all the row of pixels with each pixel defined by 4 bytes, so a 2x2 bitmap will have something like ARGBARGBARGBARGB bytes where each letter is one of four pixel component values (0-255 with 0 for no color and 255 for all RGB being white). R is Red, G is Green, B is Blue and A is Alpha - opacity or transparency. In P- or Premultiplied- pixel formats - all of RGB values are additionally multiplied by the Alpha channel value for performance reasons (IIRC).
You'll need to loop through all your pixels and set the ARGB values according to your rules to add transparency where needed, possibly un-pre-multiplying and pre-multiplying RGB as needed.

Increase Size of Black Bullets in Image in C#

Given the following image:
I need to output this image:
I want to increase the size of Black Pixels in the image using C# or AForge.Net
The image processing operation you need is morphological dilation or, in your case with black dots on white background morphological erosion.

Enlarge image in XAML & keeping seperated pixels

In a Windows Store App (C# / XAML) I'd like to show a 10x7 pixel grayscale image, but blown up so one can see the pixels. Unfortunately, by default XAML is blending neighbouring pixels like seen below, but I'd like to have sharp edges for each one so I can see where a pixel starts and where it ends. How can I achieve this?

Categories