Making pictures transparent before placement on a graphics scene?
So I have this problem right and its hard to explain but I am going to give it a shot.
I have a picture of a soccer ball on a white background which I have added to a graphics scene like so:
@ QGraphicsPixmapItem *picture = new QGraphicsPixmapItem(QPixmap("C:/Users/Public/Pictures/images (2)"));
My scenes background has been set to another color.
So what I have is a soccerball on white background inside a rectangular frame on my scene's background.
But that's not what I want
I want just the ball ,which is round, on my scene's background
My question is how do I get rid of the rest of the picture and have just the ball on my scene's background?
What type of format is your picture?
Picture is ALWAYS rectangular. So if you have a soccer ball on a white background, that background will also be displayed. So you'll have to modify the image itself.
It's ".jpg" and how do I modify the picture.
Do I modify it in paint.
Oh that won't take way the problem.
I tried changing the the shape of the bounding rect but it doesn't change how the picture is displayed on the scene.
You need a transparent background around the soccer ball in your image, rather than a white background. Unfortunately, jpg files do not support transparency. You can convert the file to a format which supports transparency, such as png. I don't think paint will handle this. There are a number of editors available for Windows, though I don't have a good list myself (I've always used GIMP, myself.) But a quick Google search could point you in the direction of some good apps which can do what you need.
Thanks Master mlong
Trying out your advice.
....some time later....
Master malong, you the man.
It works like a charm.