tagged [bitmap]

How to create bitmap from byte array?

How to create bitmap from byte array? I searched all question about byte array but i always failed. I have never coded c# i am new in this side. Could you help me how to make image file from byte arra...

4 Feb at 14:41

Converting BitmapImage to Bitmap and vice versa

Converting BitmapImage to Bitmap and vice versa I have BitmapImage in C#. I need to do operations on image. For example grayscaling, adding text on image, etc. I have found function in stackoverflow f...

26 Jun at 13:50

What's the difference between Bitmap.Clone() and new Bitmap(Bitmap)?

What's the difference between Bitmap.Clone() and new Bitmap(Bitmap)? As far as I can tell, there are two ways of copying a bitmap. How do these approaches differ? I'm particularly interested in the di...

3 Oct at 14:18

Overwrite Existing Image

Overwrite Existing Image I have this code i already have an image at my drive . i wanted to replace it with a new image every time my program runs. but a GDI+

18 Jan at 05:53

Difference between Bitmap.FromFile(path) and new Bitmap(path)

Difference between Bitmap.FromFile(path) and new Bitmap(path) I woud like to know the difference between these two: Is one option better than the other one? Does `Bitmap.FromFile(path)` fills in any a...

25 Aug at 14:52

Generate image file with low bit depths?

Generate image file with low bit depths? = bits per pixel, so 32bpp means 8/8/8/8 for R/G/B/A. Like .NET has an enum for these "System.Drawing.Imaging.PixelFormat". Now once I have a or object with my...

27 Jan at 11:18

Android: Bitmaps loaded from gallery are rotated in ImageView

Android: Bitmaps loaded from gallery are rotated in ImageView When I load an image from the media gallery into a Bitmap, everything is working fine, except that pictures that were shot with the camera...

28 May at 11:29

How do I fill a bitmap with a solid color?

How do I fill a bitmap with a solid color? I need to create a 24-bit bitmap (resolution 100x100 pixels) using a unique RGB color and save the generated image to the disk. I currently use the [SetPixel...

27 Dec at 23:50

A generic error occurred in GDI+

A generic error occurred in GDI+ I loaded an image into a Picture Box using: and I save it by using: It works perfectly fine when creating a new file, but when I try to replace the existing image, I g...

21 May at 08:26

Android: Rotate image in imageview by an angle

Android: Rotate image in imageview by an angle I am using the following code to rotate a image in ImageView by an angle. Is there any simpler and less complex method available. ``` ImageView iv = (Ima...

3 Jul at 08:51

Automatically trim a bitmap to minimum size?

Automatically trim a bitmap to minimum size? Suppose I have a `System.Drawing.Bitmap` in 32bpp ARGB mode. It's a large bitmap, but it's mostly fully transparent pixels with a relatively small image so...

27 Jan at 18:18

C# Load JPG file, extract BitmapImage

C# Load JPG file, extract BitmapImage I am trying to extract a BitmapImage from a JPG. This is the code I have: ``` FileStream fIn = new FileStream(sourceFileName, FileMode.Open); // source JPG Bitmap...

Load a bitmap image into Windows Forms using open file dialog

Load a bitmap image into Windows Forms using open file dialog I need to open the bitmap image in the window form using open file dialog (I will load it from drive). The image should fit in the picture...

How to put image in a picture box from Bitmap

How to put image in a picture box from Bitmap Is it possible to load a picture from memory (`byte[]` or `stream` or `Bitmap`) without saving it to disk? This is the code I use to turn the `byte[]` arr...

30 Jul at 19:30

converting Java bitmap to byte array

converting Java bitmap to byte array

System.drawing namespace not found under console application

System.drawing namespace not found under console application I selected console application as my C# project. But the imports that seemed to work under Windows Form project don't seem to work here. It...

Save and retrieve image (binary) from SQL Server using Entity Framework 6

Save and retrieve image (binary) from SQL Server using Entity Framework 6 I am trying to save a bitmap image to database I created a column `imgcontent` in the database with datatype `binary` but my p...

12 Oct at 10:7

fast converting Bitmap to BitmapSource wpf

fast converting Bitmap to BitmapSource wpf I need to draw an image on the `Image` component at 30Hz. I use this code : ``` public MainWindow() { InitializeComponent(); Messenger.Default.Regi...

9 Jun at 08:55

How to blit() in android?

How to blit() in android? I'm used to handle graphics with old-school libraries (allegro, GD, pygame), where if I want to copy a part of a bitmap into another... I just use blit. I'm trying to figure ...

21 Apr at 14:29

Convert image to icon in c#

Convert image to icon in c# I have a project that converts an image format file into an icon file. However, after converting the image, the color of the image changes. Here is my code ``` Bitmap theBi...

5 Jan at 00:50

What happens if i don't call dispose()?

What happens if i don't call dispose()? ``` public void screenShot(string path) { var bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bound...

4 Sep at 11:57

How to Resize a Bitmap in Android?

How to Resize a Bitmap in Android? I have a bitmap taken of a Base64 String from my remote database, (`encodedImage` is the string representing the image with Base64): ``` profileImage = (ImageView)fi...

1 Mar at 12:37

How to save PictureBox.Image to file?

How to save PictureBox.Image to file? I use the following to write jpgImage to a PictureBox.Image. and I can use the following to write a byte array to a file ``` using (var bw = new BinaryWriter(Fi...

27 Jul at 14:2

Android load from URL to Bitmap

Android load from URL to Bitmap I have a question about loading an image from a website. The code I use is: ``` Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth()...

2 Jul at 09:59

Rendering to a single Bitmap object from multiple threads

Rendering to a single Bitmap object from multiple threads What im doing is rendering a number of bitmaps to a single bitmap. There could be hundreds of images and the bitmap being rendered to could be...