Computer Science Canada

Need Help on white in pictures

Author:  The_Triangle [ Thu Nov 17, 2005 9:04 pm ]
Post subject:  Need Help on white in pictures

I am trying to get the white in this picture out for my game, but its not working out. Turing Reference says "you must know the color number that represents the color in the image that is to be transparent."

In my case the colour is white, and it is not going away.

Files attached. Help is appreciated.

Author:  beard0 [ Thu Nov 17, 2005 9:24 pm ]
Post subject: 

The proble is that the background isn't a pure white, it's many colours very close to white, only one of which is allowed to be transparent.

Author:  The_Triangle [ Thu Nov 17, 2005 9:33 pm ]
Post subject: 

beard0 wrote:
The proble is that the background isn't a pure white, it's many colours very close to white, only one of which is allowed to be transparent.


i edited the ball picture in photoshop, what program do u suggest to fill the many colours very close to white, into pure white?

and if u can do it for me , i'd appreciate it hehe Razz

Author:  beard0 [ Thu Nov 17, 2005 11:01 pm ]
Post subject: 

I would suggest simply drawing the ball in turing, given what you have. If you insist on photoshop, try paying attention to the pallet, and turn off anti-aliasing. I use the gimp - so I'm not sure how in ps.

Author:  Paul [ Thu Nov 17, 2005 11:51 pm ]
Post subject: 

I too would suggest drawing it. Although, are you sure that function is working? 'cause I edited the picture, to make sure its all white, and then did whatdotcolor for the white portion, it still wouldn't work. I myself have never seen this function before.

anyway, here's the edited picture, it gets rid of the annoying dots at least.

Author:  The_Triangle [ Fri Nov 18, 2005 8:03 am ]
Post subject: 

if anything, this guy did it.
he has jupiter with the white around it in the actual picture, but its smooth because the white isnt there in the program, and he has a diff background picture in the background too.

i'll put this up to see if it helps u guys to help me :S lol

p.s. its also found in the turing help walkthrough, i believe

Author:  beard0 [ Fri Nov 18, 2005 9:03 am ]
Post subject: 

The space program is using another technique, which also requires only one pure white, and that is that when the planet is drawn, the mode is picMerge, not picCopy. That uses the background colour as transparent while drawing the picture. This technique should work for you, if you use Paul's ball.

Author:  Albrecd [ Fri Nov 18, 2005 9:19 am ]
Post subject: 

If you use paint to make the entire background white, the default transparent colour of Turing is that white. Then just use picMerge.

Author:  The_Triangle [ Fri Nov 18, 2005 9:40 am ]
Post subject: 

beard0 wrote:
The space program is using another technique, which also requires only one pure white, and that is that when the planet is drawn, the mode is picMerge, not picCopy. That uses the background colour as transparent while drawing the picture. This technique should work for you, if you use Paul's ball.


i did use picMerge in my program

Author:  beard0 [ Fri Nov 18, 2005 9:43 am ]
Post subject: 

The_Triangle wrote:
i did use picMerge in my program


That being the case, there's no need to set a transparent colour. have you tried with Paul's ball?

Author:  The_Triangle [ Fri Nov 18, 2005 9:44 am ]
Post subject: 

Albrecd wrote:
If you use paint to make the entire background white, the default transparent colour of Turing is that white. Then just use picMerge.


but to see if my picture had the white "transparent", i changed the background to a black , and made the white transparent using the Pic.SetTransparentColour command.

The result was that the white still showed.

Oh and I also used Paul's edited ball.

Author:  beard0 [ Fri Nov 18, 2005 9:49 am ]
Post subject: 

If you change the background to black, black will be the transparent colour. Leave the background white, and drawfillbox(0,0,maxx,maxy,black). Then it will work.

Author:  The_Triangle [ Fri Nov 18, 2005 10:39 am ]
Post subject: 

beard0 wrote:
If you change the background to black, black will be the transparent colour. Leave the background white, and drawfillbox(0,0,maxx,maxy,black). Then it will work.


well yeah, but my background is gonna be a picture, so the colour of the background wont really matter.

just like in that jupiter animation, they have the background a picture.

mines gonna be like that , kind of

Author:  codemage [ Fri Nov 18, 2005 11:44 am ]
Post subject: 

If your graphics are really simple, you can save them as GIFs in photoshop. If you leave the background as transparent (it looks like a grey and white checkerboard), you don't have to worry about pallete or colour matching.

...if your pics are simple enough that GIFs are a reasonable format.

Author:  The_Triangle [ Fri Nov 18, 2005 3:17 pm ]
Post subject: 

codemage wrote:
If your graphics are really simple, you can save them as GIFs in photoshop. If you leave the background as transparent (it looks like a grey and white checkerboard), you don't have to worry about pallete or colour matching.

...if your pics are simple enough that GIFs are a reasonable format.


but the thing is... u cant use gifs in turing Sad

Author:  The_Triangle [ Fri Nov 18, 2005 3:19 pm ]
Post subject: 

beard0 wrote:
If you change the background to black, black will be the transparent colour. Leave the background white, and drawfillbox(0,0,maxx,maxy,black). Then it will work.

o ya, to help u out, in regards to the background, u cud just do

code:
setscreen ("graphics:max,max")
colourback(black)
cls


its just more easier than drawfillbox i think

Author:  beard0 [ Mon Nov 21, 2005 9:31 am ]
Post subject: 

The_Triangle wrote:
beard0 wrote:
If you change the background to black, black will be the transparent colour. Leave the background white, and drawfillbox(0,0,maxx,maxy,black). Then it will work.

o ya, to help u out, in regards to the background, u cud just do

code:
setscreen ("graphics:max,max")
colourback(black)
cls


its just more easier than drawfillbox i think



Gaaah! No! They are not equivalent. In no way shape or form!
Read what I wrote:
If you change the background to black, black will be the transparent colour.


This means that when you use a black background, any black in your image will be seen as transparent. You are wanting the white to be transparent. Therefore, the background must be white. You may draw a black box on top of that, so that the user sees a "black background," or you may draw a picture on top of that, which the user sees as a "background picture," but as far as Turing is concerned, it will still be a white background, making white the transparent coulour, and making your program work the way you want.

Author:  The_Triangle [ Mon Nov 21, 2005 3:33 pm ]
Post subject: 

beard0 wrote:
The_Triangle wrote:
beard0 wrote:
If you change the background to black, black will be the transparent colour. Leave the background white, and drawfillbox(0,0,maxx,maxy,black). Then it will work.

o ya, to help u out, in regards to the background, u cud just do

code:
setscreen ("graphics:max,max")
colourback(black)
cls


its just more easier than drawfillbox i think



Gaaah! No! They are not equivalent. In no way shape or form!
Read what I wrote:
If you change the background to black, black will be the transparent colour.


This means that when you use a black background, any black in your image will be seen as transparent. You are wanting the white to be transparent. Therefore, the background must be white. You may draw a black box on top of that, so that the user sees a "black background," or you may draw a picture on top of that, which the user sees as a "background picture," but as far as Turing is concerned, it will still be a white background, making white the transparent coulour, and making your program work the way you want.


hmmm i'll try this out, but my original background colour was black, and i have a picture as the background, and the colour i want to be transparent is white, so i just change the background colour to white now ?

Author:  The_Triangle [ Mon Nov 21, 2005 3:40 pm ]
Post subject: 

k i changed the background to white.
it didnt get rid of the white in my moving pictures, ball and paddle.

situation is this:
first comes the "colourback (0) cls"
then the background picture is called.
then the paddle picture is called
and the ball picture is called.

these r in procedures.

then in the main loop at the bottom,
i have the pic.settransparentcolour (ball,0)
pic.settransparentcolour (paddle,0)


and it still doesnt take the white out of my moving pictures..

Author:  beard0 [ Mon Nov 21, 2005 6:02 pm ]
Post subject: 

Found the problem. I actually checked out Paul's ball, and it's no good either. Here is one that works:

Author:  Paul [ Mon Nov 21, 2005 6:38 pm ]
Post subject: 

Wha..? I actually did whatdotcolor for the white portions and it showed up as 0.
Does it have anything to do with bmp vs jpg?

Author:  beard0 [ Mon Nov 21, 2005 7:21 pm ]
Post subject: 

Paul wrote:
Wha..? I actually did whatdotcolor for the white portions and it showed up as 0.
Does it have anything to do with bmp vs jpg?


Yes, it showed up as 0 - but that's only because 0 was the closest thing Turing had to the colour you were sampling which was not #FFFFFF, but close. Turing didn't recognize the difference for whatdotcolour, but did when determining background colour. Turing has trouble with this kind of thing. I generally find I have better control with bmps when working with Turing - though I wish pngs were supported.

Author:  The_Triangle [ Mon Nov 21, 2005 8:16 pm ]
Post subject: 

thanks alot for that beard0, works perfectly now Very Happy

but i got 1 more picture that needs to be fixed like that. [ it seems that i can't attach a file ] ?

can u tell me how to do that (changing all of the values to #FFFFFFF) ?

Author:  The_Triangle [ Mon Nov 21, 2005 8:22 pm ]
Post subject: 

im gonna try attaching the image again, cus before it didnt work :S

Author:  beard0 [ Mon Nov 21, 2005 8:55 pm ]
Post subject: 

le voila!

Author:  beard0 [ Mon Nov 21, 2005 8:58 pm ]
Post subject: 

Oh, yeah, you asked how...

I used Fireworks, and reduced the size of the pallet, then deleted all the light non-white colours from it.

P.S. Don't anybody jump all over me for not just editing my last post - there was no edit button for some odd reason...

Author:  The_Triangle [ Tue Nov 22, 2005 5:56 am ]
Post subject: 

Thanks alot beard0! Laughing Very Happy

yeah there was no edit button for me either and u cudnt add attachments for a while back :S

Author:  The_Triangle [ Tue Nov 22, 2005 6:00 am ]
Post subject: 

The_Triangle wrote:
Thanks alot beard0! Laughing Very Happy


..said that too fast.... it didnt work beard0... Crying or Very sad

i used Pic.SetTransparentColour again and it don't work :S

Author:  beard0 [ Tue Nov 22, 2005 9:54 am ]
Post subject: 

The_Triangle wrote:
i used Pic.SetTransparentColour again and it don't work :S


Don't use Pic.SetTransparentColour - just use Pic.Merge with the background colour.

Author:  do_pete [ Tue Nov 22, 2005 11:43 am ]
Post subject: 

Quote:
but the thing is... u cant use gifs in turing Sad

In my version you can

Author:  The_Triangle [ Tue Nov 22, 2005 3:29 pm ]
Post subject: 

do_pete wrote:
Quote:
but the thing is... u cant use gifs in turing Sad

In my version you can


and which version do u have


: