05-30-2013 11:24 AM
I have some images and I want to to crop those images so that I can use them to place on the same page . Reason to crop the image is to maintain the quality of the desired image so that I do not loose valuable space on the page while placing them on same page in PDF file .
Original image is produced by PROC GKPI in HTML file then using PROC GSLIDE it is saved as png image then using PROC GREPLAY images are placed on the same page of the pdf .
I had to to follow above complex steps to combine four graphs produced by PROC GKPI as It seems that PROC GKPI does not produce images in catalog..
Has anyone solution or alternate way of doing the task ???
05-30-2013 11:43 AM
Let me re-state your question, just to make sure I understand what you're wanting...
You want a programmatical way (in SAS) to get rid of the white-space around the Proc Gkpi gauges/etc output images, so that you can then annotate/greplay them tightly onto the same page without overlapping?
Or, if someone has an alternate way to create such a Gkpi dashboard, you'd also be receptive to that.
06-05-2013 11:49 AM
With the absence of any answers/suggestions, I think this might not be do-able.
This might be a good thing to contact tech support about, and ask them to enter a request for adding functionality to Proc GKPI to allow the user to better control the white-space around them.
06-06-2013 03:20 AM
Yeh .. This may be good idea for future version of SAS but as a soulution I also do not see any better way out of it . Anyway I never knew that we can request SAS Support for improvements in existing PROCs (don't know whether it counts or not); but yes PROC GKPI despite being execellent procedure has little to offer me regarding control on graphs.
06-06-2013 04:22 AM
i am looking forward to the solution of image cropping c# idea, i found it is hard to get rid of the white space. the quality of images is important .
06-06-2013 08:32 AM
OK - I might have figured out a programmatical (in SAS) work-around for you ...
Rather than annotating the gkpi image into a gslide within the xsys/ysys=3 0-100 coordinates, you can actually annotate the image *outside* of the visible 0-100 coordinates, thereby chopping (cropping) off the edges. ... Or, as I like to call it, literally "thinking outside the box"
Here is an example where I chop off some of the left & right edges of a gkpi png, to get rid of some of the white space:
length function $8;
x=-15; y=0; function='move'; output;
x=115; y=100; function='image'; imgpath='gkpi4.png'; style='fit'; output;
goptions xpixels=300 ypixels=300;
proc gslide anno=anno_img;
I'm attaching the gkpi4.png image (that I used in the example code), if you want to use that to experiment with:
06-24-2013 02:53 AM
I've been messing around with this, since I have a similar problem with the white spaces...
What solved it for me was just setting the "correct" goptions.
The line that worked for me came from this presentation: http://www.sas.com/offices/NA/canada/downloads/presentations/TASS09/PROC-GKPI.pdf.
It was: goptions reset=all rotate=landscape device=javaimg xpixels=240 ypixels=200;
This created a compact image without all the white space in my html file. If you change the pixels, it sometimes messes it up again (e.g. xpixels=480 ypixels=400 didn't work for me, but xpixels=320 ypixels=240 did work). I'm assuming the landscape view also has to do with this (i.e. I think SAS autofits the image in some strange way and you need to trick it into doing it in a nicer way).
Hope this helps!
12-12-2013 10:57 PM
08-29-2015 03:46 AM
Thanks for your nice sharing. Here are some code about the related image resizing process:
Private Shared Sub Main(args As String())
' Create an instance of PQScan.PDFToImage.PDFDocument object.
Dim pdfDoc As New PDFDocument()
' Load PDF document.
' Set dpi to render image
pdfDoc.DPI = 96
'Get total page count.
Dim count As Integer = pdfDoc.PageCount
For i As Integer = 0 To count - 1
'Convert page to image in target size
Dim bmp As Bitmap = pdfDoc.ToImage(i, 100, 200)
bmp.Save("output" & i & ".jpg", ImageFormat.Jpeg)
But I wonder how can I accomplish the image resizing process. Do I need another image resizing SDK to help customize the size of images? I am almost a green hand here. Any suggestion will be appreciated. Thanks in advance.