Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - What do these arguments to the cm operator mean?
  FAQ FAQ  Forum Search   Register Register  Login Login

Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

What do these arguments to the cm operator mean?

 Post Reply Post Reply
Author
Rowan View Drop Down
Moderator Group
Moderator Group


Joined: 29 Jun 2011
Points: 82
Post Options Post Options   Quote Rowan Quote  Post ReplyReply Direct Link To This Post Topic: What do these arguments to the cm operator mean?
    Posted: 14 Sep 2011 at 8:41am
[This question has been imported from the now defunct Planet PDF Q&A site.]

I'm scripting a test for the checking the DPI of embedded images.

I'm tracking the graphics state stack and concatenating the transform matrix as I go, and most cases I'm getting results that match preflight in Abobe Acrobat.

One file I'm testing with has the following cm operator call, which leaves my current transform matrix with a negative first value:

[-441.581482, 0, 0, 340.012909, 467.9263, 353.511322] cm

This is breaking my DPI calculations. I’m assuming the first value of my CTM to be the image width (in points), so a negative value is confusing me.

Given a CTM with a negative first value, how should I determine the image width in points?


Edited by Rowan - 14 Sep 2011 at 8:47am
Back to Top
Rowan View Drop Down
Moderator Group
Moderator Group


Joined: 29 Jun 2011
Points: 82
Post Options Post Options   Quote Rowan Quote  Post ReplyReply Direct Link To This Post Posted: 14 Sep 2011 at 8:42am
[This answer from user TJoe(j^) has been imported from the now defunct Planet PDF Q&A site.]

The image is mirrored in the x direction. Take the abs(value), or in other words, if less than zero, change the sign. Also, FWIW, the image is transformed by the CTM and can end up rotated, skewed, stretched, or mirrored (and so forth),  (ie: the CTM or CM may not always equal the actual image width). Taking (0,0), (0, 1), (1, 1), and (0,0) and transforming by the CTM gives you the four corners of the points in space that the image will map to. To get a DPI you need the actual image width and height (in samples) of the image (as held in the image dict), then divide by a distance calculation of the side (in space) that you are interested in (assuming that you know the scale that distance maps to). In short, checking the cm value is just the beginning.
Back to Top
Wtson145 View Drop Down
New Member
New Member
Avatar

Joined: 18 Feb 2015
Location: Pakistan
Points: 1
Post Options Post Options   Quote Wtson145 Quote  Post ReplyReply Direct Link To This Post Posted: 18 Feb 2015 at 6:11am
I'm tracking the graphics state stack and concatenating the transform matrix as I go, and most cases I'm getting results that match preflight in Abobe Acrobat.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.047 seconds.