Page 1 of 1

Get('geometry')

Posted: 2006-12-29T12:14:39-07:00
by rmabry
What's the right way to get all the image geometry, including page info?

I tried

$geom = $image->Get('geometry');

but this returns zilch (I'm still with 6.3.1-4). Using

($w,$h) = $image->Get('width', 'height');

and

($c,$r) = $image->Get('columns', 'rows');

both return identical (synonymous?) results, but I was hoping 'geometry' would give me the works: (width)x(height)+page.x+page.y.

Rick

Posted: 2006-12-29T18:24:40-07:00
by magick
Use $image->Get('columns') to return the image width, Get('rows') for the image height, and Get('page') to get the page geometry (page width, height, x, and y). The page width/height may be different from the image width/height because it represents the image virtual canvas.

Posted: 2006-12-29T20:29:17-07:00
by rmabry
magick wrote: Use $image->Get('columns') to return the image width, Get('rows') for the image height, and Get('page') to get the page geometry (page width, height, x, and y). The page width/height may be different from the image width/height because it represents the image virtual canvas.


Thanks, yes, 'page' is exactly what I thought 'geometry' would give. (What DOES 'geometry' return?)

Posted: 2006-12-29T21:46:52-07:00
by rmabry
magick wrote: Get('page') to get the page geometry (page width, height, x, and y).


Without resorting to split-ing or other perly string manipulations (which wouldn't be difficult, I'll grant), are the x and y ready to Get separately? E.g.,

$image->Get('pagex', 'pagey') ?

How's this?

Code: Select all

          if (LocaleCompare(attribute,"pagex") == 0)
            {
              if (image != (Image *) NULL)
                s=newSViv((long) image->page.x);
              PUSHs(s ? sv_2mortal(s) : &sv_undef);
              continue;
            }
          if (LocaleCompare(attribute,"pagey") == 0)
            {
              if (image != (Image *) NULL)
                s=newSViv((long) image->page.y);
              PUSHs(s ? sv_2mortal(s) : &sv_undef);
              continue;
            }
It seems to work for me and 'twould be useful.

"Can we keep it, Dad, please, can we keep it?"

(Used to work when we were kids.)

Posted: 2006-12-30T10:04:16-07:00
by magick
We will instead use page.x and page.y as attributes available in the next Beta release by tommorrow.

Posted: 2006-12-30T11:39:25-07:00
by rmabry
magick wrote: We will instead use page.x and page.y as attributes available in the next Beta release by tommorrow.


You are a indeed kind and speedy Santawizard.

Image