bitmap

How can I stretch bitmap in WPF without smoothing pixels

Hi, I'm working on SEM image processing application, written in WPF. I have an image display control, derived from Canvas, which displays image & overlays using DrawingVisuals (one for each "layer"). It also implements Zoom & Pan using scale & translate transform, applied on DrawingVisuals. When I zoom in the image to see individual pi...

How to stretch a bitmap in C and SDL?

I am making a game for my CS class and the sprites I have found online are too small. How do you 'stretch' a bitmap... make them bigger using SDL? (I need to increase there size 50%, there all the same size.) A snippet of example code would be appreciated. ...

C++: building iterator from bits

I have a bitmap and would like to return an iterator of positions of set bits. Right now I just walk the whole bitmap and if bit is set, then I provide next position. I believe this could be done more effectively: for example build statically array for each combination of bits in single byte and return vector of positions. This can't be ...

How to clip a rectangle from a tiff?

I have a Winforms Gui in C# that allows a user to draw a rectangle on a display of a tiff and save the position, height, width etc. Basically, what I want to do is take the saved position, height and width of the rectangle and clip that area into a sep. bitmap that can then be passed to sep. method that will just OCR the new clip of the...

Bitmap byte-size after decoding?

Hi! How can I determine/calculate the byte size of a bitmap (after decoding with BitmapFactory)? I need to know how much memory space it occupies, because I'm doing memory caching/management in my app. (file size is not enough, since these are jpg/png files) Thanks for any solutions! Update: getRowBytes * getHeight might do the trick....

CreateDIBSection leaving 'Not enough storage' error, but seems to still work anyway

Whenever my app tries to create a DIB section, either by calling CreateDIBSection(), or by calling LoadImage() with the LR_CREATEDIBSECTION flag, it seems to return successfully. The HBITMAP it returns is valid, and I can manipulate and display it just fine. However, calls to GetLastError() will return 8: Not enough storage is availabl...

Read pixel data from an image file in .NET

I am trying to read in the pixel data from an image file as a byte[], for in-memory storage. (The byte array will later be fed to a bitmap image object, but I want the data in memory so that there's no I/O holdup.) This is what I'm currently doing: private byte[] GetImageBytes(Uri imageUri) { //arraySize and stride previously de...

Reading in bytes produced by PHP script in Java to create a bitmap

I'm having trouble getting the compressed jpeg image (stored as a blob in my database). here is the snippet of code I use to output the image that I have in my database: if($row = mysql_fetch_array($sql)) { $size = $row['image_size']; $image = $row['image']; if($image == null){ echo "no image!"; } else { ...

Memory leak while asynchronously loading BitmapSource images

I have a fair few images that I'm loading into a ListBox in my WPF application. Originally I was using GDI to resize the images (the originals take up far too much memory). That was fine, except they were taking about 400ms per image. Not so fine. So in search of another solution I found a method that uses TransformedBitmap (which in...

How to smooth an image loaded with FileReference?

Been trying to smooth images loaded with FileReferece with no luck. Below is the code I'm using: fileRef = new FileReference(); fileRef.addEventListener(Event.COMPLETE, fileLoaded); private function fileLoaded(e:Event):void{ var ldr:Loader = new Loader(); ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, funct...

ASP.NET error on Bitmap.Save "Exception (0x80004005): A generic error occurred in GDI+."

Hi, I have a function which first reads an image from disk, resizes it and then saves to another directory. when i use the Bitmap.Save(directory + theimagename) it returns the error as i stated in the question title. i checked the directory is right, and the given image name doesn't exist in that dir. what is weird, is that the same c...

Is passing System.Drawing.Bitmap across class libraries unreliable ?

Hi, I have a 3rd party dll which generates a Bitmap and send back its reference. If I generate a System.Windows.Media.Imaging.BitmapSource out of it immediately then all goes well. But if I save the reference and later on (after a few seconds and many function calls) I try to generate the Bitmapsource, I get System.AccessViolationE...

Bitmap.Save problems

Hello, can anyone tell me if you know to be a problem with Bitmap and steganography for WM 6? I am working on a project and i have to hide a digital signature in a bitmap. The algorithm works perfect, as in untill i have the image on the memory the bitmap contains the modified bytes. But after i save the image (Bitmap.Save()) and I reo...

OCR: How to improve accuracy - existing libraries for removing non-text 'furniture', shapes, etc to avoid confusing OCR?

I want to remove rectangles etc that enclose text in a screenshot image, so that I can perform optical character recognition to get accurate text from the screenshot. Background: I doing this to extract data from a legacy application for use with other applications. This is the only way to get at this data as associated files are in a ...

Resize an 8bpp bitmap in GDI+

I've just noticed that GDI+ doesn't like the Graphics.FromImage() method to be called with an image that is 1bpp, 4bpp, or 8bpp. Is there any way of resizing an 8bpp image without changing from 8bpp to 24bpp, resizing, and then changing it back to 8bpp? ...

WPF: How to efficiently update an Image 30 times per second

Hello, I'm writing a WPF application that uses a component, and this component returns a pointer (IntPtr) to pixels of a bitmap (stride * height). I know in advance that the bitmap is a 24bits rgb, its width and height. Updating the Image control with these bitmaps makes up a video to the user, but I'm not sure what's the most efficient...

C# Graphics class: get size of drawn content

I am writing to Graphics object dynamically and don't know the actual size of final image until output all peaces to the Graphics. So, I create a large image and create Graphics object from it: int iWidth = 600; int iHeight = 2000; bmpImage = new Bitmap(iWidth, iHeight); graphics = Graphics....

Bitmap manipulation in C++ on Windows

Hi, I have myself a handle to a bitmap, in C++, on Windows: HBITMAP hBitmap; On this image I want to do some Image Recognition, pattern analysis, that sort of thing. In my studies at University, I have done this in Matlab, it is quite easy to get at the individual pixels based on their position, but I have no idea how to do this in C...

how to load an imageview by url in android?

for example i have an image's url: http://java.sogeti.nl/JavaBlog/wp-content/uploads/2009/04/android_icon_256.png i want to load this link image into my imageview in my project.how? ...

Cannot open a .tif with color using .Net Image or Bitmap classes

I am attempting to open .tif files that have color in them (300 dpi, PixelFormat.Format24bppRgb) using the .Net Image and Bitmap classes. I always get an "invalid parameter" error when the tiffs have color (works fine for black and white tiffs). If anyone has source code on how to open a .tif with color in it I'd deeply appreciate it. ...