Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Nomlas  
#1 Posted : Thursday, May 31, 2007 12:00:18 AM(UTC)
Nomlas

Rank: Member

Groups: Member
Joined: 4/7/2007(UTC)
Posts: 4

Sorry for the simple questions, but I'm nearly done with my evaluation....

How do I change all occurrances of one RGB value to another? I'm a bit confused about whether palettes need to be used and how to create them if they don't exist.

Tried this from a sample, but I get an error about operation requiring a palette.

Code:
    Dim I As Integer
    BitMapViewer.Bitmap.Data.ConvertTo8bppIndexed DitheringTypeNone, , , , ,   PaletteTypeGrayscale
    BitMapViewer.Bitmap.ColorTreatment = ColorTreatmentColorref
    BitMapViewer.AutoUpdate = False
    
    For I = 1 To BitMapViewer.Bitmap.Data.Palette.Count - 2
      BitMapViewer.Bitmap.Data.Palette(I) = RGB(I, I, 0)
    Next
    
    BitMapViewer.AutoUpdate = True
    BitMapViewer.Refresh

Thanks again.

Edited by user Monday, February 25, 2008 7:00:43 PM(UTC)  | Reason: Not specified

Dmitry  
#2 Posted : Thursday, May 31, 2007 4:51:21 PM(UTC)
Dmitry

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 8/3/2003(UTC)
Posts: 1,070

Thanks: 1 times
Was thanked: 12 time(s) in 12 post(s)
Hello,

If you want to replace one color with another in an image, you should read color data from every pixel, and change it (if it is required). The fastest way to perform this task is to use direct access to pixel data. This approach is discussed in Accessing to Pixel Data article.

Edited by user Tuesday, December 15, 2009 10:43:05 AM(UTC)  | Reason: Not specified

Sincerely yours,

Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.