RetouchPRO

Go Back   RetouchPRO > Tools > Software > Photoshop Scripting

Notices

Photoshop Scripting Learning and sharing for all platforms

Reply
 
LinkBack Thread Tools
  #1  
Old 01-29-2005, 10:43 AM
byRo's Avatar
Moderator
 
Join Date: May 2004
Location: Goiânia, Brazil
Posts: 1,549
Pixelated - Javascript

Following Doug's suggestion I'm posting here the script that I used to make the "punched-out" image in Doug's "Pixelated" thread.

Some observations:
- Many times I find the "normal" method() syntax too unweildy and instead make a function from the ScriptListener output.
Quote:
Originally Posted by method
docRef.selection.select([[x,y], [x2,y], [x2,y2], [x, y2]], SelectionType.REPLACE, 0, false);
comes out as:
Quote:
Originally Posted by function call
fnSELECT ( pxTOP_ , pxLEFT , pxBTOM , pxRGHT );
- I am trying to follow a naming convention as suggested by here by Michael:
ly = Layer;
fn - Funcion;
db = Double precision number;
with user names in capitals, so you'll find:lyBASE, pxMAX_H, dcDOC etc......

Comments and suggestions most welcome - as always

Attached Files
File Type: zip Selection - punch holes.zip (1.1 KB, 5 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Float This Post!Stumble this Post!Google Bookmark this Post!Yahoo Bookmark this Post!Live Bookmark this Post!Share this post on Facebook
Reply With Quote
  #2  
Old 01-29-2005, 10:59 AM
byRo's Avatar
Moderator
 
Join Date: May 2004
Location: Goiânia, Brazil
Posts: 1,549
Replying to Danny's post on the original thread:
Quote:
Originally Posted by DannyRaphael
If I may offer my "wishlist..."
* Selection based (to isolate what area got pixelated). Default = all.
* A variable that would control amount (or ~ %) of pixelation, e.g., 1 = a few random squares, 10 = lots of squares
I had thought of using a layer - but your suggestion of using an alpha channel would be more concise solution. Though not black a white - but greyscale where the lighter parts would increase the probability.
Quote:
Originally Posted by DannyRaphael
* Ability to choose size of square
This should be the easiest part, but I haven't found a good way to do it yet!
Quote:
Originally Posted by DannyRaphael
* Squares isolated on a separate layer to which layer effects could be applied.
The second version (to be posted) that I used here does just that - although it takes a lot longer to run.

Thanks for the feedback!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Float This Post!Stumble this Post!Google Bookmark this Post!Yahoo Bookmark this Post!Live Bookmark this Post!Share this post on Facebook
Reply With Quote
  #3  
Old 01-30-2005, 01:15 PM
byRo's Avatar
Moderator
 
Join Date: May 2004
Location: Goiânia, Brazil
Posts: 1,549
Here's the latest effort. (image)
Not quite as clean-cut as I'd like it - but it works.
Apparently working with selections isn't that straightforward!
Had to use a pre-defined layer style ("byRo Tiles") to be able to do the bevel and emboss.

Any help or comments would be most welcome.

Attached Files
File Type: zip Falling Tiles.zip (1.6 KB, 7 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Float This Post!Stumble this Post!Google Bookmark this Post!Yahoo Bookmark this Post!Live Bookmark this Post!Share this post on Facebook
Reply With Quote
  #4  
Old 01-30-2005, 03:57 PM
DannyRaphael's Avatar
Moderator
Patron
 
Join Date: Mar 2002
Location: Near Seattle, Washington, USA
Posts: 5,660
It was instructive to see the line of code to apply the layer style within the .js. IMO you'll get a lot fewer implementation questions if you comment out that line (but include instructions within the script on "how" to utilize it).

Just let folks apply a LS of their choosing after the script runs.

Bottom line: Pretty slick.
Attached Images
File Type: jpg Bus Stop 2 byRo.jpg (70.5 KB, 19 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Float This Post!Stumble this Post!Google Bookmark this Post!Yahoo Bookmark this Post!Live Bookmark this Post!Share this post on Facebook
Reply With Quote
  #5  
Old 01-31-2005, 03:33 AM
byRo's Avatar
Moderator
 
Join Date: May 2004
Location: Goiânia, Brazil
Posts: 1,549
Danny, good to see it worked for you!

Quote:
Originally Posted by DannyRaphael
Just let folks apply a LS of their choosing after the script runs.
But that was the whole problem..
I had to apply the style while I had an individual tile isolated. When I applied a bevel-and-emboss-type style after, the tiles becames pretty shapeless blobs. However you're right - not much good posting a script that won't work, will substitute.

I had to fight this program all the way:
- apparently a Selection can't be an object;
- after copying to a new layer the selection gets deselected;
- layer merges don't include layer styles, have to use merge visible;
- only way to apply bevel and emboss is by using a pre-defined style, can't define layer styles on the run;
- selection.transform doesn't work (at least not for PS 7.0), had to wriggle out using Edit>Transform on the layer.

If anybody has some experience with selections I'd be real glad to hear.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Float This Post!Stumble this Post!Google Bookmark this Post!Yahoo Bookmark this Post!Live Bookmark this Post!Share this post on Facebook
Reply With Quote
  #6  
Old 01-31-2005, 10:32 AM
DannyRaphael's Avatar
Moderator
Patron
 
Join Date: Mar 2002
Location: Near Seattle, Washington, USA
Posts: 5,660
I'm shooting in the dark here...

Does "- apparently a Selection can't be an object" = you can't do the script equivalent of Select > Save selection to create a named alpha channel which could (in theory) be repeatedly invoked via the .js equ. of Select > Load selection?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Float This Post!Stumble this Post!Google Bookmark this Post!Yahoo Bookmark this Post!Live Bookmark this Post!Share this post on Facebook
Reply With Quote
  #7  
Old 01-31-2005, 01:30 PM
byRo's Avatar
Moderator
 
Join Date: May 2004
Location: Goiânia, Brazil
Posts: 1,549
Quote:
Originally Posted by DannyRaphael
I'm shooting in the dark here...
A near miss!
I'll try and turn the lights on...
I had imagined that, with all the used-defined objects that javascript allows, I could simply write something like:
Quote:
Originally Posted by example
var slTILE = dcDOC.selection
and I'd have a nice little selection object to play with - but PS javascript didn't seem to agree on that.
The method you suggested will work fine (I hadn't thought of that), and if I need more than one selection I'll sure do it that way. This time I just needed to repeat the select line.

Just got a little disappointed that my cunning sly move didn't work!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Float This Post!Stumble this Post!Google Bookmark this Post!Yahoo Bookmark this Post!Live Bookmark this Post!Share this post on Facebook
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pixelated Celebrities Game Doug Nelson Salon 617 03-02-2007 05:35 PM
Pixelated Healing brush delic Photo Restoration 2 02-01-2006 12:57 PM
Severely Pixelated Image AndrewR Image Help 10 08-01-2005 05:05 AM
resizing for a table clare Your Website 16 02-24-2003 02:15 PM
Javascript program garfield Software 4 12-02-2002 08:40 AM


All times are GMT -6. The time now is 08:13 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Copyright © 2008 Doug Nelson. All Rights Reserved




1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51