- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Has anyone successfully brought in an external gif/png image with a transparent background and gotten it to work as expected?
I have an ODS LAYOUT region with a colored background, and tried to drop a png image file on to it that has a transparent background. I want the underneath layer to show through the transparent part. Target is a PDF file.
I'm not sure if it is the .png file or what I'm doing in SAS.
Thanks!
--Ben
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It might help to show the code you have that involves the ODS statement and the procedure(s) that reference the PNG file so we have some details to discuss to consider.
Also the version of SAS you are running might be a factor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It depends on what procedures you are using for graphics. Here are many examples using transparent images with SGPLOT procedure: http://blogs.sas.com/content/graphicallyspeaking/?s=transparent+images
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I was running a sample program:
dm 'clear log';
ods escapechar='^';
ods PDF file="&path.test.pdf" notoc;
ods layout absolute y=.25in x=.25in width=10.5in height=8in style={background=green};
ods region width=10in height=7in;
ods text = "^{style[background=blue postimage='&impath.test.png'].}";
ods layout end;
ods pdf close;
With the attached test.png; orientation was landscape. Was expecting the cyan hexagon to have a green background and the surrounding rectangle to be either blue or green. It was magenta, which was the color I had tried to set to transparent.
--Ben
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Oh..am on 9.4 TS1M3. Sorry.
---Ben
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@BenConner wrote:
With the attached test.png; orientation was landscape. Was expecting the cyan hexagon to have a green background and the surrounding rectangle to be either blue or green. It was magenta, which was the color I had tried to set to transparent.
Perhaps the plot thickens: How did you attempt to set the magenta to transparent? Does that image appear transparent when viewing it in other applications or viewers?
This link
http://stackoverflow.com/questions/14220221/how-to-insert-transparent-png-in-pdf
may shed some light in general about PNG, transparency and PDF.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Interesting post. So apparently png files aren't natively compatible with PDF files. How about gifs?
--Ben
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Good morning,
It does appear it was an issue with how the transparency layer was defined in the image. Used a different graphics package that I know better and it worked as advertised. Including as a .png file.
Sorry for the confusion!
--Ben