Re: Replace pixel color



Draw the icons using an ImageAttributes object and a ColorMatrix that will
modify the colours.

If images are shades of gray then you can selectively filter any of the G,G
or B components to change the hue.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"Mark Heath" <MarkHeath@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B6608657-3DB1-4225-A257-C2041CB4261E@xxxxxxxxxxxxxxxx
>I have some PNG files containing icons that are entirely one color - a
> forground color of gray and a transparent background. I have loaded these
> into Bitmap objects that I am painting using the DrawImage command. I
> would
> like to sometimes paint the same icon, but with a different foreground
> color.
> Is there a quick and easy way of doing this using GDI in .NET?
>
> I tried using GetPixel and SetPixel but this returns an error: "SetPixel
> is
> not supported for images with indexed pixel formats"
> Also, the image Palette property contains no entres so I couldn't change
> that.
>
> If all else fails I can just make some more PNG files, but I am hoping
> there
> is a more elegant solution.
>
> thanks
> Mark


.



Relevant Pages

  • Re: bad PNGs, thunderbird and firefox
    ... most of the icons in thunderbird and *some* images in ff ... In the folders list, it's all of the icons except that for "Drafts" & folders. ... the manner of distortion changes slightly: sometimes everything is predominantly purple and other times kind of a caustic green. ...
    (Fedora)
  • Re: bad PNGs, thunderbird and firefox
    ... most of the icons in thunderbird and *some* images in ff are ... Is anbody seeing anything like this? ...
    (Fedora)
  • Re: image icon problem
    ... When I connect the hard drive to my computer at home and transfer the images files to my computer hard drive, the file icons appear as jpeg icons, not thumbnails. ... With the Flash Trax downloads, it is impossible to determine image content without opening each file. ...
    (rec.photo.digital)
  • Re: Do we have such a container control?
    ... Dim colWidth as Long ... 'I'll use 5 in the example below, meaning the width will be 5 Icons ... Now after the Images are loaded into the Imagelist.... ...
    (microsoft.public.vb.general.discussion)
  • Re: Will this end the hoaxters??
    ... lighter shade of gray? ... If the orbiter takes multiple images crossing the landing areas, ... are seeing as something other than just a few gray pixels. ...
    (sci.astro.amateur)