BookmarkSubscribeRSS Feed
BrunoSilva
Quartz | Level 8
Hi all,

Someone knows if is possible to preserve transparency of a gif image when used in a proc report with ods pdf?
I want to avoid that annoying white square on the images without create an icon for each combination of colour.

Thanks in advance 🙂

Sample code for test only:

filename rpt "d:\temp\test.pdf";

options nodate nonumber center ;
ods escapechar='^';
ods pdf file=rpt notoc uniform;

title;
footnote;

proc report data=sashelp.class nowd split="~"
style(report)={cellspacing=0 cellpadding=5 frame=box rules=group}
style(header)={background=cx009d57 foreground=cxffffff cellheight=0.25in vjust=middle just=center}
style(column)={cellheight=0.18in};

columns name age height weight;
define name / display
style(header)={pretext=" " preimage="D:\temp\16GreenCheck.gif" cellwidth=2in};
run;


ods pdf close;
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
I'm confused...the BACKGROUND color that you have for the Header cell is green. The checkmark is green. How will anyone even see a green checkmark against a green background (if transparency were used)??

When you use an image with ODS PDF or ODS RTF (no matter whether the image is an external image or the image is created with SAS/GRAPH), the image must be CONVERTED from whatever form it is in to an internal PDF or RTF format.

If I submit this program, using an image that I know has a transparent background (my image is taller than yours, so it needed a cellheight, too):
[pre]
options nodate nonumber center ;
ods escapechar='^';
ods html file="c:\temp\testimage_gif_trans.html";
ods pdf file="c:\temp\testimage_gif_trans.pdf" notoc uniform;

title;
footnote;

proc report data=sashelp.class nowd split="~"
style(report)={cellspacing=0 cellpadding=5 frame=box rules=group}
style(header)={background=pink foreground=cx000000 cellheight=0.25in vjust=middle just=center}
style(column)={cellheight=0.18in};

columns name age height weight;
define name / display
style(header)={pretext=" " preimage="c:\temp\trans_img.gif"
cellwidth=2in cellheight=2.75in};
run;

ods _all_ close;

[/pre]


Then what happens is that the HTML file uses the GIF image as it is and I do not see a white background under the image. However, in the PDF file, once the conversion is done, there is a white background behind my image. This difference between HTML and PDF indicates to me that the issue is that the conversion of the image into PDF format does not respect or use the transparency.

You might want to open a track to Tech Support on this question. I don't know whether there is a workaround (other than plopping the image onto a white background) or if this is known Adobe issue.

cynthia
BrunoSilva
Quartz | Level 8
Hello,

Thanks for the quick answer.

:) yes green with green was not a good example.

It seams that is a common question over the web. i found the comment bellow and i think maybe the problem is the images that i use, but i need to make a few tests.

"Only certain graphic file formats offer transparency as an option. One example is the GIF format.

Although some scanning software can produce a GIF, none that I know of automatically remove the white background to produce transparency.

In other words, just because you have a GIF file doesn't’t mean it has transparency.

You’ll need to use a tool to remove the background to produce the transparent effect."

From : http://www.gregledet.net/?p=5
Cynthia_sas
SAS Super FREQ
That was the point of my test. I checked my image in Paint Shop Pro and made sure that my GIF did have a transparent background. The HTML file used the GIF with the transparent background. The PDF file showed a white background for the image, even though I KNOW that my image has a transparent background.

cynthia
ScottH_SAS
SAS Employee
We are working on transparency for our next release

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1121 views
  • 0 likes
  • 3 in conversation