Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transparent background on a report Picture

Status
Not open for further replies.

Timalaugh

Programmer
Aug 10, 2011
31
US
Hi All,
I have a Picture/OLE on a report that is mapped to a changing data field that points to a .jpg file.

I know all the Pictures have transparent backgrounds because of how they look in Paint.

They work fine on the FoxPro report except they do not display the transparent background but a white background.

I need the transparent backgrounds... Any Help Please ?
 
The way I do this is to convert the JPG to a BMP. Set the transparent areas to pure white. When the BMP appears in a report, the white will become transparent again. (The same happens if you display the BMP on a form.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Thanks Mike...

Unfortunately this is a logo photo that needs to go on top of other photos that will be of any/many colors.
...clever Idea though

Timalaugh
 
this is a logo photo that needs to go on top of other photos that will be of any/many colors.

So where does the transparency come it? Photos don't naturally have transparent areas. How do you define which bits you want to be able to see through?

Have you considered using a MSK file? This lets you define arbitrary areas of an image that are to be transparent. If that's what you want, see the Help topic, "How to: Enhance Control Display" for details of how to create a MSK file.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
the Photos are not Cropped, therefor they have an area people call "the background".

As I stated in my initial question,
I need the "Background" to be transparent.
That is how the pictures were provided to me.
I can see this when I paste them on top of another photo in MS Paint and uncheck the Draw Opaque option.

any more questions I can help you with Mike?
 

Sorry every one if I got a little sarcastic.
I have been working on this problem all day.

Timalaugh
 
I need the "Background" to be transparent.
That is how the pictures were provided to me.
I can see this when I paste them on top of another photo in MS Paint and uncheck the Draw Opaque option.


One problem is that you are experiencing how pictures may be handled and properties that they may have in an application dedicated to processing pictures/images (M$ Paint) and then equating it to an application that is not (VFP).

And then you are using that experience to assume that the picture files come to you with a transparent background -- when, in reality, they may only be displayable in that manner within an image processing application like Paint, Paint Shop Pro, etc.

Find another non-VFP application and non-image processing application and see if you can get the pictures to display as you want - maybe over a non-white background so that you can see through the background if they are indeed 'transparent'.

I could be wrong but I am guessing that the 'transparent' background is not in the picture files themselves, but in how they are processed within Paint.

Good Luck,
JRB-Bldr
 
To follow the logic of the test I suggested you might try M$ Word.

Create a document with a colored background and then Insert the Image from a File (your logo file) and check the results.

If the image in the file does indeed have a 'transparent background' then the document background color should appear through the logo image.

If the image background is not transparent then you will not see the document colored background.

NOTE - while you can play with images a good bit even in M$ Word, doing so would defeat the simplistic test of the image's true background transparency.

Good Luck,
JRB-Bldr
 
As I stated in my initial question,
I need the "Background" to be transparent.

Sorry, but I still don't get it. If you have a photo of a man standing in a field, then the man is the foreground; the grass, trees and sky are the background. I'm sure you don't mean that these should be transparent.

You also say "the Photos are not Cropped". I don't see what cropping has got to do with the background, one way or the other.

Do you mean that there is an area around the edges of the photo that should be transparent? A sort of border, that is white in the photo but should not obscure whatever is behind the photo in the report? If so, then my original solution should work, provided you convert the JPG to a BMP, and the area in question is pure white.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Technically a JPG has no transparency. Mike has pointed out several options of VFP to introduce transparency: Mask files and pure White in BMP files (BMP can be 16 Million Colors, too) And PNG is onother option. I'm not sure, though, if that is handled correcly within The Olecontainer on a report.

Could you perhaps upload one of these partially transparent pictures to let us see? Or do you have a better image processing software, eg Gimp? Gimp will tell you, if there is transparency in a picture.

What you can do is set a report control to the back, so other things, like labels and fields print in front.

Bye, Olaf.
 
When I drop the first photo on the page, then
drop another photo on it, I need the background area
of the second photo to be transparent so it looks like
part of the first photo... and the company photo people know what they are doing... I can not cast doubt on them like some of you are casting doubt on me... and besides I did run tests to make sure the second photos have transparent backgrounds.

and by the way, my boss asked me to do this to save the photo guys time in combining the many hundreds of product photos with the Logo photos.

If you do not understand or you just do not believe me, please do not reply ! ...and we must also consider that perhaps FoxPro simply can not do this.

Thx for trying...
Tim
 
Tim,

I'm sorry you feel annoyed about this. I was genuinely trying to understand the problem - and I'm sure the others were too. In my case, it was the concept of a photo with a "transparent background" that had me stumped.

Never mind. I hope you manage to sort it out.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
no troubles Mike, and thanks

It is just odd that I know FoxPro supports transparent backgrounds.
If you click on just about any object on a report you can select Format, then Backstyle then select opaque or transparent...
But not on a Picture/Ole object. (I am using VFP 9)

... yes I guess I am a bit annoyed... at FoxPro

Thx
Tim
 
some of you are casting doubt on me.

We are not casting doubt on you or your intelligence, but perhaps on the assumptions you are making about the 'transparency' of the photo backgrounds.

the company photo people know what they are doing

Again we do not doubt that they know what they are doing.
I myself can make a wide variety of things happen to a photo if I am doing it in an image processing software package like Paint, Paint Shop Pro, or others, but that does not mean that the final photo image in the file you receive will be as 'advertised'.

Before you get upset about how we are replying to your question I'd repeat my recommendation from above - that you perform some tests independent of both image processing software and VFP to confirm what the photos within the image file(s) you are being asked to use 'truly' look like.

If in independent testing they are shown to have a totally transparent 'background' then fine.
If not, then so be it - and you will need to work with the image files you are given.

If you want a suggestion for a test - try the following:
* Open a new document in MS Word
* From the Toolbar use Format - Background to make the document page background color [Red]RED[/Red]
* Now from the Toolbar use Insert - Picture - From File... and locate & select your Logo file.
* If you see the [Red]RED[/Red] document background through the Logo image background then it is 'transparent'.
* If not, then it is not.
Photo background transparency confirmed or not - End of discussion.

we must also consider that perhaps FoxPro simply can not do this.

If the photo background transparency is not confirmed, then VFP, which is not an image processing software package, cannot do anything to create it. It can use the image files as they are received.

Good Luck,
JRB-Bldr
 
I did the test and yes it has a transparent background in ms Word but not in FoxPro.
 
Tim,

I can only second the others, my doubts are not about your intelligence, just a lack of knowledge - or mine. JPG has no transparency in my knowlegde, that would be such a new feature, that I suppose Fox wouldn't support it.

It's also news to me Windows Paint would support and show transparency.

I googled a bit and foiund out JPEG2000 does indeed have transparency, but I think foxpro does not support that format, at least not that feature.

Transparent PNG is supported and does not depend on any transparency setting of the Image control, it will simply let shine through, what is behind it.

What you also may see in Word or other applications is the feature to set a transparency level for the whole picture, that's enabling you to blend two pictures, true, but it's not a picture property, then.

Overall, if the pics don't automatically let shine through, what's behind, there is no other setting you can use. Your only chance is to convert to PNG or BMP plus MSK.

Bye, Olaf.
 
I also conducted the tests using a .PNG image file... same results.

"Your only chance is to convert to PNG or BMP plus MSK."

.. I will look into .MSK file now
 
are you using VF9 and the new report engine? SET REPORTBEHAVIOUR 90


FWIW I just overlay a jpg image with a PNG with transparent background and it came out fine (see
worth noting it didn't look like this in the report designer... only at runtime.



another option you may want to explore is to use GDI+ to merge the two photos (and save to a temporary file) before you print.


i was sure i had some code lying around somewhere that did this but i can't find it just now..... i probably stole it from Ceaser Chalom in the first place so have a look here


(about half way down looks relevant to you dated TUESDAY, AUGUST 28, 2007


hth
nigel
 
THAT'S IT!!!

All this time I thought that the default REPORTBEHAVIOUR was 90 in VFP 9.0... I guess it was not. Just to make sure it was 90 I typed SET REPORTBEHAVIOUR 90 it into the application just before the report call.

Now I have a transparent background on the .PNG photos !!!

note: The so called transparent .JPG photos still did not show as transparent though.

Thanks very much everyone...

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top