šŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #20621

Re: Cropping a circle image

#20621
From: Shane Stanley
Date: Sun, 16 Jun 2002 23:46
58 lines
2791 bytes
in article ef920b5.-1@WebX.aaQKaf7vad4, john chu wrote:

> Iļæ½m kind of new with Photoshop. Dose the cropping only do rectangular? Is it
> possible to crop a circle in an image?

Wrong place to ask, but what the heck. AppleScript and VB only support
rectangular cropping, but you can use either to call javascript to do the
job. For example:

set theScript1 to "var id10 = charIDToTypeID( \"setd\" );
 var desc4 = new ActionDescriptor();
 var id11 = charIDToTypeID( \"null\" );
  var ref1 = new ActionReference();
  var id12 = charIDToTypeID( \"Chnl\" );
  var id13 = charIDToTypeID( \"fsel\" );
  ref1.putProperty( id12, id13 );
 desc4.putReference( id11, ref1 );
 var id14 = charIDToTypeID( \"T   \" );
  var desc5 = new ActionDescriptor();
  var id15 = charIDToTypeID( \"Top \" );
  var id16 = charIDToTypeID( \"#Pxl\" );
  desc5.putUnitDouble( id15, id16, "
set theScript2 to " );
  var id17 = charIDToTypeID( \"Left\" );
  var id18 = charIDToTypeID( \"#Pxl\" );
  desc5.putUnitDouble( id17, id18, "
set theScript3 to " );
  var id19 = charIDToTypeID( \"Btom\" );
  var id20 = charIDToTypeID( \"#Pxl\" );
  desc5.putUnitDouble( id19, id20, "
set theScript4 to " );
  var id21 = charIDToTypeID( \"Rght\" );
  var id22 = charIDToTypeID( \"#Pxl\" );
  desc5.putUnitDouble( id21, id22, "
set theScript5 to " );
 var id23 = charIDToTypeID( \"Elps\" );
 desc4.putObject( id14, id23, desc5 );
 var id24 = charIDToTypeID( \"AntA\" );
 desc4.putBoolean( id24, true );
executeAction( id10, desc4, DialogModes.NO );
"

tell application "Adobe Photoshop 7.0"
 tell settings
  set ruler units to pixel units
 end tell
 tell current document
  set theWidth to width
  set theheight to height
 end tell
 activate
 do javascript (theScript1 & "0" & theScript2 & "0" & theScript3 &
(theheight as text) & theScript4 & (theWidth as text) & theScript5) show
debugger before running
end tell

-- 
Shane Stanley,  sstanley@myriad-com.com.au
Technical Details
Message-ID: <B9335DB2.33645%sstanley@myriad-com.com.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-06!supernews.com!iad-peer.news.verio.net!news.verio.net!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <ef920b5.-1@WebX.aaQKaf7vad4>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f939a,488dbd89361dd223
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-06-16 17:07:31 PST
From: Shane Stanley <sstanley@myriad-com.com.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-06!supernews.com!iad-peer.news.verio.net!news.verio.net!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Cropping a circle image
Message-ID: <B9335DB2.33645%sstanley@myriad-com.com.au>
Date: Sun, 16 Jun 2002 16:46:32 -0700
References: <ef920b5.-1@WebX.aaQKaf7vad4>
Lines: 62
User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.3
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit