Click here to Skip to main content
15,906,106 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: DataList web user control Pin
Sandeep Mewara26-Mar-11 21:46
mveSandeep Mewara26-Mar-11 21:46 
QuestionLog messages in event viewer Pin
berba24-Mar-11 0:24
berba24-Mar-11 0:24 
AnswerRe: Log messages in event viewer Pin
Pete O'Hanlon24-Mar-11 3:28
mvePete O'Hanlon24-Mar-11 3:28 
QuestionSSRS page break problem Pin
rahul.net1123-Mar-11 23:49
rahul.net1123-Mar-11 23:49 
AnswerRe: SSRS page break problem Pin
Sandeep Mewara26-Mar-11 21:45
mveSandeep Mewara26-Mar-11 21:45 
Questionregular expression validator Pin
Satish_S23-Mar-11 21:21
Satish_S23-Mar-11 21:21 
AnswerRe: regular expression validator Pin
thatraja23-Mar-11 23:12
professionalthatraja23-Mar-11 23:12 
QuestionManipulating Colour Indexed Images (GIF) using palettes - ASP.NET C# Pin
Quintec23-Mar-11 16:08
Quintec23-Mar-11 16:08 
Hi Smile | :) Im using ASP.net / C#

My english is not very good, but i will try my best to explain what i need.

There are 2 questions:


Question 1) I want to be able to know the colour index of a pixel from a GIF format file.

With that I mean, as you know, a gif image file contains a colour palete, which is an array of length 256. Each array item from 0 to 255 contains a colour, and in GIF files, colours can be repeated in different positions. For example, I can have a grayscale palette, which will look something like this [#000000, #010101, #020202, ..., #FEFEFE, #FFFFFF], but in my case, all the colours are the same, lets say red:
[#FF0000,#FF0000,#FF000, ..., #FF0000]. That is perfectly valid in a GIF File, since each pixel is not tied to a colour, instead, it is tied to an index in the colour table. So even if the whole image is red (looks red), the actual bitmap data could be something like this:

(this code is conceptual, not actual C# code)
palete = redPalete; // [#ff0000,..., #ff0000] all red colours
pixelData = [[1,2,3,4,5,6,7,8,9,10 ... 256],
[1,2,3,4,5,6,7,8,9,10 ... 256],
...
[1,2,3,4,5,6,7,8,9,0 ... 256]]; //supose the pixel data is a matrix of colour indexes.


In this example, my image has all possible colours from the palette, but since the palette is all red, the image will look red.

Ok, that is ok, but now my problem, is...

How can I open that external GIF File, and iterate through pixels, retrieving its associated colour index in the palette table instead of the actual colour?? According to the previous example:

int colourIndex = miImage.getPixelColourIndex(0,0);

and i dont want to retrieve the value #ff0000, instead, i want to obtain the value 1.

and if i say:

int colourIndex = miImage.getPixelColourIndex(1,0); //colourIndex should be 2, since [[1,2,3 ....]

¿anyone got the idea of what i need? I need to know the colour index associated with a pixel, instead of the actual colour of that pixel (since several colour indexes can point to the same colour value, in this case red).



Question 2) Question 2 is exactly the opposite case. I want to write an indexed image (and then save it to GIF), according to the colour indexes values, instead of the colour.

That means, i want to do:

myImage.setPixel(0,0,1); //being setPixel(x, y, colourIndex);

i want that instead of saying the actual colour, which could look like:

myImage.setPixel(0,0,#ff0000); // I dont want this, i want to use the index value, not the colour, since my palette will contain all red values.



Please!!! I will sincerely appreciate help with this, I guess there is not a native function to do that, but probably there is a way around it, isnt it??

Thank you for reading and for your help in advance Wink | ;-)


Alvaro
AnswerAnyone? Pin
Quintec26-Mar-11 1:41
Quintec26-Mar-11 1:41 
Questionwhen we use delegates? Pin
anoop_m8323-Mar-11 16:03
anoop_m8323-Mar-11 16:03 
AnswerRe: when we use delegates? Pin
Pravin Patil, Mumbai23-Mar-11 22:47
Pravin Patil, Mumbai23-Mar-11 22:47 
Questionbypass web filter Pin
yftah198923-Mar-11 6:37
yftah198923-Mar-11 6:37 
AnswerRe: bypass web filter PinPopular
Richard MacCutchan23-Mar-11 7:28
mveRichard MacCutchan23-Mar-11 7:28 
GeneralRe: bypass web filter Pin
yftah198923-Mar-11 7:43
yftah198923-Mar-11 7:43 
AnswerRe: bypass web filter Pin
Pravin Patil, Mumbai23-Mar-11 7:58
Pravin Patil, Mumbai23-Mar-11 7:58 
AnswerRe: bypass web filter Pin
Pete O'Hanlon23-Mar-11 7:58
mvePete O'Hanlon23-Mar-11 7:58 
GeneralRe: bypass web filter Pin
yftah198923-Mar-11 8:13
yftah198923-Mar-11 8:13 
GeneralRe: bypass web filter Pin
Pete O'Hanlon23-Mar-11 8:25
mvePete O'Hanlon23-Mar-11 8:25 
GeneralRe: bypass web filter Pin
yftah198923-Mar-11 8:33
yftah198923-Mar-11 8:33 
GeneralRe: bypass web filter Pin
Richard MacCutchan23-Mar-11 23:03
mveRichard MacCutchan23-Mar-11 23:03 
GeneralRe: bypass web filter Pin
GenJerDan25-Mar-11 3:21
GenJerDan25-Mar-11 3:21 
AnswerRe: bypass web filter Pin
Keith Barrow23-Mar-11 9:09
professionalKeith Barrow23-Mar-11 9:09 
GeneralRe: bypass web filter Pin
gavindon23-Mar-11 9:27
gavindon23-Mar-11 9:27 
GeneralRe: bypass web filter Pin
GenJerDan25-Mar-11 3:23
GenJerDan25-Mar-11 3:23 
GeneralRe: bypass web filter Pin
gavindon25-Mar-11 3:45
gavindon25-Mar-11 3:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.