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: Mon, 28 Jul 2008 13:12:10 -0700
- Thread-topic: replacing embedded images in Illustrator
On 7/25/08 3:04 PM, "Stan Cleveland" wrote:
> Oops!!! The code in my first message was flawed. The code below is correct.
Oops again!!! I realized that the only use I'd made of the code that "fixes"
matrix values misreported by Illustrator CS3 was for placed images that are
scaled, translated (moved), or reflected (mirrored). After checking, I
realized that matrix values for placed images that are rotated or sheared
(skewed) were NOT getting fixed.
After more experimental work over the weekend, below is code that I believe
correctly fixes matrix values for scaling, translation, vertical or
horizontal reflection, rotation, and shearing of placed images. I haven't
tested for reflection at an angle.
(It makes me wonder what's so "special" about the numbers 7885 and 8587.)
Embedded images appear to have correct matrix values in all cases.
I noted another problem with Illustrator. If an image is embedded, the
'embedded' property is reported as true. But if an image is not embedded,
the 'embedded' property is unavailable. The code below also includes a
workaround for this issue.
For anyone who can use this, enjoy!
Stan C.
-- 'a' and 'b' are reserved keywords in Illustrator (for Lab values)
-- so have used 'aa' and 'bb' as alternate variable names
tell document 1 of application "Adobe Illustrator" -- CS3
set {aa, bb, c, d, tx, ty} to {mvalue_a, mvalue_b, mvalue_c, ¬
mvalue_d, mvalue_tx, mvalue_ty} of matrix of page item 1
try
embedded of page item 1
on error number -1728
set {aa, bb, c, d, tx, ty} to my fixMatrixValues(aa, bb, c, d, tx, ty)
end try
end tell
return {aa, bb, c, d, tx, ty}
on fixMatrixValues(aa, bb, c, d, tx, ty)
set bFixed to -bb
set dFixed to -d
set txFixed to (7885 * aa) - (8587 * c) + tx
set tyFixed to (8587 * d) - (7885 * bb) + ty
return {aa, bFixed, c, dFixed, txFixed, tyFixed}
end fixMatrixValues
_______________________________________________
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