Re: replacing embedded images in Illustrator
Re: replacing embedded images in Illustrator
- Subject: Re: replacing embedded images in Illustrator
- From: Stan Cleveland <email@hidden>
- Date: Fri, 25 Jul 2008 14:45:51 -0700
- Thread-topic: replacing embedded images in Illustrator
On 7/25/08 4:20 AM, "Shane Stanley" wrote:
> On 25/7/08 7:23 PM, "Hamish Sanderson" <email@hidden>
> wrote:
>
>> Have I missed something? And what's with matrix
>> values changing depending on whether an image is linked or embedded?
>
> Search me; the matrix in Illustrator remains a mystery to me. But FWIW, it
> seems to me that a matrix should automatically cover position, so setting
> both at the same time might be asking for conflict.
>
> I've no idea what cause the change with embedding, but it looks to me that
> mvalue_tx and mvalue_ty reflect position of an embedded image.
>
> The pragmatist in me suggests you try setting embedded to false, and work
> from there...
Sorry to be a bit slow with my response.
There's a bug in how Illustrator CS3 reports matrix properties for placed
images. (Embedded images are reported correctly.) Fortunately, the bug is
consistent and can be worked around.
Below are four examples showing how to calculate the correct matrix values
from the incorrect ones supplied for placed images. The algorithms were
determined through experimentation, but have worked flawlessly (so far).
Hamish, you should be able to grab the placed-image matrix values, correct
them, make the embedded image, and apply the corrected matrix values to it.
FYI, Illustrator's matrix is based on the standard 3x3 matrix used for
two-dimensional transformations. Illustrator values are mapped into this
matrix thusly:
+--- ---+
| mvalue_a mvalue_b 0 |
| mvalue_c mvalue_d 0 |
| mvalue_tx mvalue_ty 1 |
+--- ---+
(The rightmost column always contains 0, 0, 1, so Adobe apparently chose to
ignore those values.) Further study into 2D transformational matrices is
left as an exercise for the reader, but here's a good starting point:
http://www.ia.hiof.no/~borres/cgraph/math/twod/p-twod.html
HTH,
Stan C.
-- image at 100%, x = 72, y = 720
-- embedded values are correct
set {a, b, c, d, tx, ty} to {1.0, 0.0, 0.0, 1.0, 72.0, 720.0}
-- placed values are wrong!
set {a, b, c, d, tx, ty} to {1.0, 0.0, 0.0, -1.0, -7813.0, 9307.0}
set dFixed to -d
set txFixed to 7885 * dFixed + tx
set tyFixed to 8587 * d + ty
-- image at 50%, x = 72, y = 720
-- embedded values are correct
set {a, b, c, d, tx, ty} to {0.5, 0.0, 0.0, 0.5, 72.0, 720.0}
-- placed values are wrong!
set {a, b, c, d, tx, ty} to {0.5, 0.0, 0.0, -0.5, -3870.5, 5013.5}
set dFixed to -d
set txFixed to 7885 * dFixed + tx
set tyFixed to 8587 * d + ty
-- image at 50%, x = 72, y = 720
-- embedded values are correct
set {a, b, c, d, tx, ty} to {0.25, 0.0, 0.0, 0.25, 72.0, 720.0}
-- placed values are wrong!
set {a, b, c, d, tx, ty} to {0.25, 0.0, 0.0, -0.25, -1899.25, 2866.75}
set dFixed to -d
set txFixed to 7885 * dFixed + tx
set tyFixed to 8587 * d + ty
-- image at 74.1171598434%, x = 175.35693359375, y = 565.494140625
-- embedded values are correct
set {a, b, c, d, tx, ty} to {0.741171598434, 0.0, 0.0, 0.741171598434, ¬
175.35693359375, 565.494140625}
-- placed values are wrong!
set {a, b, c, d, tx, ty} to {0.741171598434, 0.0, 0.0, -0.741171598434, ¬
-5668.78125, 6929.9345703125}
set dFixed to -d
set txFixed to 7885 * dFixed + tx
set tyFixed to 8587 * d + ty
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden