Sg2.9
Raster origin
Recent RSS
Raster origin
From:  Richard Holt
Date:  8. June 2011, 19:37

Is there a way to establish the origin coordinates of a raster image on the page, so that I can draw vectors exactly on top of it?

There seem to be variables for various characteristics of the raster (width, height etc) but not its position, and consequently its origin point x & y.

Can this be done? Have I missed something obvious?

Cheers!

®

Re: Raster origin
From:  PDXIII
Date:  9. June 2011, 12:18

Hello RIchard!

you may use position? Because Raster inherits from item. OR maybe you can use getSubImage().

Found in Raster.

Greetz
PDXIII

Re: Raster origin
From:  Richard Holt
Date:  9. June 2011, 18:02

Thanks for the advice, I found the answer in the Raster part of the documentation as directed and figured it out in the end:

// Establish the origin point of the raster image to draw from in document units rather than pixels

var imagex=(raster.bounds.x);
var imagey=(raster.bounds.y);

// Establish the dimensions of the raster in document units rather than pixels

var imagewidth=(raster.bounds.width);
var imageheight=(raster.bounds.height);

Has worked like a charm

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Sudoku Generator + Solver 03.01.13