RetouchPRO

Go Back   RetouchPRO > Tools > Software > Photoshop Scripting
Register Blogs FAQ Site Nav Search Today's Posts Mark Forums Read


Photoshop Scripting Learning and sharing for all platforms

Pixelated - Javascript

Reply
 
Thread Tools
  #1  
Old 01-29-2005, 11:43 AM
byRo's Avatar
byRo byRo is offline
Senior Member
 
Join Date: May 2004
Location: Goianésia, Brazil
Posts: 1,609
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)
Reply With Quote top
  #2  
Old 01-29-2005, 11:59 AM
byRo's Avatar
byRo byRo is offline
Senior Member
 
Join Date: May 2004
Location: Goianésia, Brazil
Posts: 1,609
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!
Reply With Quote top
  #3  
Old 01-30-2005, 02:15 PM
byRo's Avatar
byRo byRo is offline
Senior Member
 
Join Date: May 2004
Location: Goianésia, Brazil
Posts: 1,609
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)
Reply With Quote top
  #4  
Old 01-30-2005, 04:57 PM
DannyRaphael's Avatar
DannyRaphael DannyRaphael is offline
Moderator
 
Join Date: Mar 2002
Location: Near Seattle, Washington, USA
Posts: 6,300
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, 22 views)
Reply With Quote top
  #5  
Old 01-31-2005, 04:33 AM
byRo's Avatar
byRo byRo is offline
Senior Member
 
Join Date: May 2004
Location: Goianésia, Brazil
Posts: 1,609
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.
Reply With Quote top
  #6  
Old 01-31-2005, 11:32 AM
DannyRaphael's Avatar
DannyRaphael DannyRaphael is offline
Moderator
 
Join Date: Mar 2002
Location: Near Seattle, Washington, USA
Posts: 6,300
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?
Reply With Quote top
  #7  
Old 01-31-2005, 02:30 PM
byRo's Avatar
byRo byRo is offline
Senior Member
 
Join Date: May 2004
Location: Goianésia, Brazil
Posts: 1,609
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!

Reply With Quote top
Reply

  RetouchPRO > Tools > Software > Photoshop Scripting


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
Refbacks are Off


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


All times are GMT -6. The time now is 12:15 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
Copyright © 2016 Doug Nelson. All Rights Reserved