Data visualization with SAS programming

pixels per inch and other mysteries

Reply
Regular Contributor
Posts: 179

pixels per inch and other mysteries

Hi,

 

I've been working recently with Absolute Layout positioning of boilerplate graphic images mixed with data from Procs, etc. and continue to struggle with sizing boilerplate graphics users want on reports.

 

What determines the pixels per inch for a given graphic (say .png file)?

 

I have a png file I tried to display going to a PDF file.  The region was 4" tall and 10" wide in a landscape region.  While it filled the page width from the original Word document, it was 2-3 inches too short in the PDF file SAS created.  The info on the image was 2645x1056 and had a pixels per inch value of 330.

 

I increased the size of the image and got the 'won't fit in the region' error, so I knocked it down.  And kept reducing it and the same thing occurred.  I looked at the image info again on the resized image and found it was 1120x447 pixels at 200 pixels per inch.  Even at that value it should have had plenty of room but it still gets suppressed.

 

I didn't set the pixels per inch value so something certainly is doing it for me.  Would like it to match whatever the PDF file needs.  ?

 

The code I used was:

ods PDF file="&path.absolute3.pdf" notoc dpi=300;

 

ods layout absolute y=.25in x=.25in width=10.5in height=8in style={background=yellow};

 

ods region height=4in width=10.5in style={background=lightblue}; * For cover picture;

ods text = "^{style[preimage='&impath.boilerplate3.png']} ";

 

ods layout end;

ods pdf close;

 

 

The error message I get is:

WARNING: The absolute region was too small to accommodate the output supplied for the PDF destination. Output will be suppressed.

 

 

Thanks!

 

--Ben

 

 

SAS Super FREQ
Posts: 8,818

Re: pixels per inch and other mysteries

Hi:
ODS LAYOUT is fairly new and questions like this are probably better handled by Tech Support. If they don't know the answer, they can involve the ODS LAYOUT developer.

From my understanding the challenge with PDF output is that you have an image (like a logo) or a graph (created with ODS) and BOTH of those images will get converted to an internal PDF image format. So beyond your sizing for the PNG file, there is some additional translation involved in getting all the images embedded in the PDF document.

How that works is a mystery to me, but since you have a fairly specific ODS LAYOUT question, this seems to me the type of question best suited to Tech Support where they can look at all your code and all your images and help you come to a resolution.

cynthia
Regular Contributor
Posts: 179

Re: pixels per inch and other mysteries

Will do.  Also posted the generic question to a graphics forum w/o the SAS component.

 

Thanks!

 

--Ben

Respected Advisor
Posts: 4,812

Re: pixels per inch and other mysteries

Please report back what you find. That would certainly help many others.

PG
Regular Contributor
Posts: 179

Re: pixels per inch and other mysteries

Got a reply from Bari Lawhorn in SAS T.S.  She pointed me to the usage note:

http://support.sas.com/kb/46/333.html

 

SAS' implementation of PDF output requires setting the DPI resolution to 150 for best results.  The graph I had been given was 330.  After resizing it, as an added bonus the file was a lot smaller as well.

 

What irks me is that many weeks ago in the first stages of learning this stuff, I had run across this usage note, read it, and tucked it away.  In a very safe place.  Sigh...

 

Once the image was resized, it looked great!

 

--Ben

 

Ask a Question
Discussion stats
  • 4 replies
  • 367 views
  • 4 likes
  • 3 in conversation