wordpress hit counter
Re: Get Pixels/EMUs Informations - PresentationML - Formats - OpenXML Developer

Re: Get Pixels/EMUs Informations

Formats

Discussions about working with different Open XML Formats

Get Pixels/EMUs Informations

  • rated by 0 users
  • This post has 6 Replies |
  • 0 Followers
  • Hello!

    I have in PPTX Presentation this code:

      <a:blip r:embed="rId2" cstate="print" />
      <a:srcRect l="15555" t="30556" r="15556" />
    - <a:stretch>
      <a:fillRect />
      </a:stretch>
      </p:blipFill>
    - <p:spPr bwMode="auto">
    - <a:xfrm>
      <a:off x="4038600" y="2209800" />
      <a:ext cx="2362200" cy="1905000" />
      </a:xfrm>
     
    CX = 2362200 / 9525 = 248 pixels
    CY = 1905000 / 9525 = 200 pixels
     
    srcRect have three attributes:  left, top and right.
     
    When I transform EMU to PIXELS:
     
    L = 15555 / 9525 = 1.63 pixels
    T = 30556 / 9525 = 3.20 pixels
    R =  15556 / 9525 = 1.63 pixels
     
    This values aren't correct because image is cropped wrong.
     
    What I can do?
     
  • Hi,

    For cropping the image, original height, width and the resolution of the image (from image property summary tab) has to be taken. Then apply the l,t,r attribute values of <a:srcRect> element to the original value to get the cropped image.

    Sheela

  • Where can I find the resolution of the image? I didn't found the image property summary.
     
    If I have the coordenates cx, xy, l,t,r above and one image with 825x600. What the cropped area?
     
    Thanks !
     
  • Hi,


    For  image width and height , we have to look on cx and cy value in slide.xml.there cx and cy in emu
    that we have to convert in inch.
     
    This is the formula
     
    cx/(360000*2.54)
     
    cy/(360000*2.54)
     
     
    this is applicable in both the cases before and after cropping

     


    Sheela

  • Sheela,

    No problem when I calculate the coordenates (cx and cy).

    Using the formula:

    Image CX: (2362200 / (360000 * 2.54)) * 96;
    CX = 248 px;

    Image CY: (1905000 / (360000 * 2.54)) * 96;
    CY = 200 px;

    PERFECT RESULTS!

    ____________________________________________

    I have difficult to work with <srcrect> T, L, R, B.

    When I calculate the cropped area ... I get low values using the formula:

    Top Crop:
    T = (30556 / (360000 * 2.54)) * 96;
    T = 3.2 pixels

    Left Crop:
    L = (15555 / (360000 * 2.54)) * 96;
    L = 1.6 pixels

    Right Crop:
    R = (15556 / (360000 * 2.54)) * 96;
    R = 1.6 pixels

    What is the problem? This values aren't correct!

  • Hi, 

        cx and cy values are in EMU but l ,t ,r , b are represen ted in percentage in1000th of percent  (not in EMU). 
     
        1. first we have to divide these values by 1000
     
         2. t hen for l and r  we have to calulate how much percent these value of cx value before cropping
     
            by   Bcx*l,r/100       Bcx = value of cx before cropping
     
           then for t and b we have to calulate how much percent these value of cy value before cropping
     
           by   Bcy*t,b/100       Bcy = value of cy before cropping
     
     
          the value of l,r,t,b you will get after 2nd step that will be in emu now
     
         then again we have to convert it to inch
     
          by   l,r,t,b/(360000*2.54) 
     
     
    Mallika 
  • Mallika and Sheela,

    Thanks!

Page 1 of 1 (7 items)