gdi+

JPEG artifacts removal in C#

Hi all I am building a website for a club that is part of a mother organisation. I am downloading (leeching ;) ) the images that where put on profile pages of the mother organisation to show on my own page. But their website has a nice white background, and my website has a nice gray gradient on the background. This does not match nicel...

Crop a picture in C# with the use of rectangle box

I want to crop a pic in c#. As in most photo editing softwares i want to use the rectangle box which can be resize and move with mouse(as in most image editing softwares). plz also tell that how it is possible that the pic inside the rectangle is bright while outside is darker. following pic give the some idea........ http://img3.im...

How can we use the colormatrix only a part of image rather than whole image?

I know the use of colormatrix. but this work on the whole image. is there any way to work with colormatrix only a part of image rather than whole image. eg i want to give the brightness of only border area of image. i am working with c#. ...

can not draw on GDI+ bitmap object.

I am writing program in c++ gdi gdi+. Drawing large image on gdi+ bitmap is slow is using gdi+ api. So I used the following way to draw: Bitmap img(xxx); Graphics gr(&img); HDC dc = gr.GetHDC(); ::StretchDIBits( dc, rec.left, rec.top, (rec.right - rec.left), (rec.bottom - rec.top), m_recRegin.left , m_recRegin.top, ...

Winforms ListView Selection Drawing?

Is it possible to override the listview detault selection paint? The one that looks semi-transparent blue overlayed over the items, like in the explorer windows. I want to draw an outline around the selection to indicate selection. Any way to do this? Examples are appreciated. ...

Create a new image on the file system from System.Drawing.Image?

Ok, I'm sorry, this is probably a noob question but I'm kinda stuck. So what I'm doing (on my asp.net application) is loading an image from the file system: System.Drawing.Image tempImage; tempImage = System.Drawing.Image.FromFile(HttpContext.Server.MapPath(originalPath)); Then I do some resizing: tempImage = my awesomeResizingFunct...

System.Drawing.Graphics.DrawString - "Parameter is not valid" exception

Sometimes Microsoft's exception messages are infuriatingly unhelpful. I have created a nice little MVC method to render text. The method body is below. When it reaches the "DrawString" method, I get an exception thrown saying "Parameter is not valid". Note that the font, as best I can tell is constructed properly (I"m just using Arial a...

System.Drawing.Matrix, I understand what it does, but how does it work?

I've used the Matrix class a thousand times. I have an elementary grasp of matrix mathematics, it's been years since I've had a class on the subject. But I don't fully understand what this class is doing under the hood to manipulate the points in a GraphicsPath. What, specifically, is it doing in there as it pertains to GraphicsPaths i...

combining multiple transparant png's using GDI+ causes OutOfMemoryException

Hi, I'm trying to combine multiple fairly large png files (7000 by 7000 pixels) that have transparency (32bpp) using GDI+. In the OnPaint event of a usercontrol I draw the images on top of each other like this: Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) Try If Not mImageList Is Nothing Then e.Graphics.Tr...

Windows Forms: Making a cursor bitmap partially transparent

I want to use partially transparent images in drag/drop operations. This is all set up and works fine, but the actual transformation to transparency has a weird side effect. For some reason, the pixels seem to be blended against a black background. The following image describes the problem: Figure a) is the original bitmap. Figure ...

overlaying images with GDI+

Hi, I'm trying to overlay a image with a couple of other images. I use this code to do that: Dim gbkn As Bitmap = New Bitmap(7001, 7001, Imaging.PixelFormat.Format32bppArgb) Dim g As Graphics = Graphics.FromImage(CType(gbkn, Image)) g.DrawImage(Image.FromFile("C:\background.png"), New Point(0, 0)) g.DrawImage(Image.FromFile("C:\firstla...

How can an application write text to the screen?

How can an application write text to the screen without using any DrawText type methods, and how can I catch it? I've hooked the following: DrawText DrawTextA DrawTextW DrawTextEx DrawTextExA DrawTextExW TextOut TextOutA TextOutW ExtTextOut ExtTextOutA ExtTextOutW PolyTextOut PolyTextOutA PolyTextOutW None of them yields a thing. ...

overlaping images using GDI+ (C#)

Hi all, I'm trying to write a webApplication that holds two png images- big one and smaller one, I need to use the bigger one as a base and place the smaller one on it in a specific posiotion, the smaller one has transparent areas so it adds information to the base picture. I'm using GDI+ with C#, but I managed only to upload one pictur...

Problem with GDI generated fonts in 64-bit Vista

We’re building a custom output display dialog. In it we display thumbnails (bitmaps) in a listbox. There is also a larger, detail view which is a GDI vector image retrieved from PrintPreviewEventArgs (PreviewPrintController) and displayed in a WindowsFormsHost:PictureBox. The thumbnail bitmaps are created from the original GDI image, ...

GDI+ book from 2001: outdated or still relevant?

I'm trying to learn GDI+ (in C#). CodeProject has this article which is a free chapter from the 2001 WROX book Professional C#. Is this still an advisable way to learn GDI+ or is a more modern resource preferable? If the latter, what would be such a resource? ...

GDI+ leaks memory when deleting pointers as GdiplusBase*? (C++)

Hi all, I'm trying to work with GDI+ and I'm running into a weird memory leak. I have a vector of GdiplusBase pointers, all of them dynamically created. The odd thing is, though, is that if I try to delete the objects as GdiplusBase pointers, e.g. vector<GdiplusBase*> gdiplus; gdiplus.push_back(new Image(L"filename.jpg")); delete gdiplu...

Removing black border around an image

I have a few JPG Images. Some of them may have a black border on one or more sides, and I'd like to remove them. The black border may not go around the actual image - some may only have the border at the bottom (with the actual image at the top), while some could be centered (which means black borders on two sides, but not connected). Wo...

How do I draw an Image with a programmatically set alpha channel in .NET?

This is a .NET application on Windows forms using C++/CLI. I have a JPEG that I want to paint in my client area to represent an object. On some occasions -- like when the user is dragging objects around -- I'd like to draw the object with some transparency. What are the various available ways to do this? ...

problem drawing few images on top of an image- one image at a time using c# asp.net

Hi all! I'm trying to draw few images on top of one image (using GDI+)- which if you do it all at once is not a problem, but I want the images to appear one at a time- for the example here: there is one image on the top of the webPage at all times- a house picture, when you click on one of the buttons- a flower is added on the house i...

C# problem with closing my small game when the form closing event is fired

Hi! I have for a school assignment created a small game, it is divided into 2 different projects, one project with the form and one with a DLL-file containing the game. The game loop is very simple and looks like this: private void GameLoop(Graphics g) { int lastTick = Kernel32.GetTickCount(); do { ...