How to retrieve width and height of JPG and PDFs?
How to retrieve width and height of JPG and PDFs?
Best answer by mac_sp
For the JPG, you can extract the width and height from the IFMERaster information:
Running your JPG features through a GeometryExtractor into Well Known Text will return a Polygon geometry type with the four corners of your image, as such:
POLYGON ((0 -960,0 0,528 0,528 -960,0 -960))
Your image width is simply the non-zero x coordinate and your height is the non-zero y coordinate.
For the PDF, you need to read rasterized pages in the reader parameters:
This will provide the Raster extents for each page (the 'pdf_page_number' attribute tracks the page number) and you can complete the above steps with the GeometryExtractor to derive the height and width.
EDIT: A CoordinateExtractor could be used to produce a similar result, simply depends on the user preference.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.