Print Page | Close Window

Can you get an ImageID from an ImageList?

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2408
Printed Date: 06 Feb 26 at 8:04AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Can you get an ImageID from an ImageList?
Posted By: ChrisH
Subject: Can you get an ImageID from an ImageList?
Date Posted: 19 Sep 12 at 4:51PM
Is there anyway to get the ImageID of an image in an ImageList returned from GetPageImageList that can be used with SelectImage?

What I'm looking to do is retrieve the image's resolution (dpi) to calculate the print size of the images that belong to a specified page. While GetImageListItemIntProperty will return the pixel size, it won't return the resolution information.

I think this is an area of missing functionality, the GetImageListItemIntProperty should support a way of returning the ImageID to be used with all of the other image handling functions.

Thanks.



Replies:
Posted By: Ingo
Date Posted: 19 Sep 12 at 7:41PM
Hi Chris!

If this is a missing functionality you should
post your question on the official support-pages
from the publishers. Here it's the user-user-forum ;-)

Cheers and welcome here,
Ingo



Posted By: ChrisH
Date Posted: 19 Sep 12 at 7:50PM
Thanks I'll do that. I was hoping I was just completely overlooking how to do it :)


Posted By: AndrewC
Date Posted: 20 Sep 12 at 6:11AM
Good question.

We have two functions in QPL for finding images and they work in different ways.

FindPages() and GetPageImageList()

1. FindPages will search through the Resources dictionary for each image on the page and then report back each image object/stream that was found in the PDF.  It will only report the image once even if the image is used many times on the same page or on multiple pages.  It cannot tell you if the image is used or not, cannot tell you exactly on which page it it used or even the size it is used at for rendering.  It just reports the raw image properties - it cannot report scaling, rotation etc.  It does have access to the DPI setting of the raw image data.  If you render the image then the DPI used will be different to this DPI as scaling, rotation etc will afftect the actual rendered DPI.

2. GetPageImageList will do a fast render of the current page and report back any and all images that were processed during the quick render process.  If the same logo is used on the top and bottom of the page then this image will be reported twice.

You can use the GetImageListItemIntProperty function to return the image width and height in pixels (option 401 and 402 respectively).  You can also use the GetImageListItemDblProperty to determine the size of bounding box that the image was used to draw the image.  

DPIx =  width in pixels / bbox.width * 72.0;
DPIy =  height in pixels / bbox.width * 72.0;

or

DPIx = GetImageListItemIntProperty(401) / (QP.GetImageListItemDblProperty(503) -  (QP.GetImageListItemDblProperty(501)) ;
DPIy = GetImageListItemIntProperty(402) / (QP.GetImageListItemDblProperty(504) -  (QP.GetImageListItemDblProperty(502)) ;

This is assuming that the image box is not rotated for any reason.

As for getting the ImageID and using it with the other image functions - I will need to do some consulting with the programmers and some testing to see what might be possible in the future.

I hope that helps.  Do you have a reason why you think the ImageID would be good to have or does FindImages solve that problem for you ?

Andrew.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk