b3ta.com board
You are not logged in. Login or Signup
Home » Messageboard » Message 6822322

# One of these
(, Mon 5 Feb 2007, 5:35, archived)
# Nice!
(, Mon 5 Feb 2007, 5:37, archived)
# lsd lol
ah, you ninja'd
(, Mon 5 Feb 2007, 5:39, archived)
# Yeah.
 
I've been wanting to make a filter joke about these pictures, but it just doesn't seem funny.

It's a neat effect, though.
(, Mon 5 Feb 2007, 5:43, archived)
# NOW GIVE ME YOUR LSD.
(, Mon 5 Feb 2007, 5:44, archived)
#
(, Mon 5 Feb 2007, 5:46, archived)
# FRANKENSTEIN!
(, Mon 5 Feb 2007, 5:58, archived)
# Well here's a formula you can start out with :)


// ------------------------------------------------------------------------------------------------
// FUNCTIONS
// ------------------------------------------------------------------------------------------------

// FUNCTION to create a selection
function makeSelection (top_s, left_s, bottom_s, right_s, isElipse) {

var setd = charIDToTypeID( "setd" );
var actDesc_1 = new ActionDescriptor();
var charID_null = charIDToTypeID( "null" );
var actRef_1 = new ActionReference();
var charID_chnl = charIDToTypeID( "Chnl" );
var charID_fsel = charIDToTypeID( "fsel" );
actRef_1.putProperty( charID_chnl, charID_fsel );
actDesc_1.putReference( charID_null, actRef_1 );


var charID_T = charIDToTypeID( "T " );
var actDesc_2 = new ActionDescriptor();
var charID_pxl = charIDToTypeID( "#Pxl" );
var charID_top = charIDToTypeID( "Top " );
actDesc_2.putUnitDouble( charID_top, charID_pxl, top_s );
var charID_left = charIDToTypeID( "Left" );
actDesc_2.putUnitDouble( charID_left, charID_pxl, left_s );
var charID_btom = charIDToTypeID( "Btom" );
actDesc_2.putUnitDouble( charID_btom, charID_pxl, bottom_s );
var charID_rght = charIDToTypeID( "Rght" );
actDesc_2.putUnitDouble( charID_rght, charID_pxl, right_s );

if (isElipse == true) {
var charID_elps = charIDToTypeID( "Elps" );
actDesc_1.putObject( charID_T, charID_elps, actDesc_2 );
var charID_anta = charIDToTypeID( "AntA" );
actDesc_1.putBoolean( charID_anta, true );

} else {
var charID_rect = charIDToTypeID( "Rctn" );
actDesc_1.putObject( charID_T, charID_rect, actDesc_2 );
}

executeAction( setd, actDesc_1, DialogModes.NO );

}


// FUNCTION to merge all layers to a single layer
// NOTE : OTHER LAYERS ARE USUALLY DISCARDED BY THIS FUNCTION
function mergeAll () {
while (doc.artLayers.length > 1) {
doc.activeLayer = doc.artLayers[0];
doc.activeLayer.merge();
}
}


// FUNCTION to discard and apply a layer mask to the active layer
function applyLayerMask () {
var charID_dlt = charIDToTypeID( "Dlt " );
var actDesc_3 = new ActionDescriptor();
var charID_null = charIDToTypeID( "null" );
var actRef_2 = new ActionReference();
var charID_chnl = charIDToTypeID( "Chnl" );
var charID_msk = charIDToTypeID( "Msk " );
actRef_2.putEnumerated( charID_chnl, charID_chnl, charID_msk );
actDesc_3.putReference( charID_null, actRef_2 );
var charID_aply = charIDToTypeID( "Aply" );
actDesc_3.putBoolean( charID_aply, true );
executeAction( charID_dlt, actDesc_3, DialogModes.NO );
}

// FUNCTION to undo changes to the "original image" layer
function undoImageChange () {
var charID_slct = charIDToTypeID( "slct" );
var actDesc_4 = new ActionDescriptor();
var charID_null = charIDToTypeID( "null" );
var actRef_3 = new ActionReference();
var charID_hsts = charIDToTypeID( "HstS" );
var charID_ordn = charIDToTypeID( "Ordn" );
var charID_prvs = charIDToTypeID( "Prvs" );
actRef_3.putEnumerated( charID_hsts, charID_ordn, charID_prvs );
actDesc_4.putReference( charID_null, actRef_3 );
executeAction( charID_slct, actDesc_4, DialogModes.NO );
}

// FUNCTION to generate a random number within a range
function getRandomNumber (min, max) {
randNum = Math.floor(Math.random() * ((max + 1) - min) + min);
return randNum;
}


// ------------------------------------------------------------------------------------------------
// PREPARE THE DOCUMENT
// ------------------------------------------------------------------------------------------------

// store ruler unit preference
var originalRulerUnit = preferences.rulerUnits;

// set temporary script-specific ruler preference
preferences.rulerUnits = Units.PIXELS;

// get a reference to the active document
var doc = app.activeDocument;

// merge all current layers to produce an "original image" layer
// IDEALLY THIS SHOULD BE DEPENDENT UPON A CONDITIONAL CONFIRMATION DIALOGUE BOX
mergeAll();

// add a new normal art layer
// THIS IS THE 'dot' LAYER THAT THE DOTS WILL BE ADDED TO
var dotLayer = doc.artLayers.add();
dotLayer.kind = LayerKind.NORMAL;


// ------------------------------------------------------------------------------------------------
// CREATE THE DOTS
// ------------------------------------------------------------------------------------------------


// set the elipse top left and bottom right points and the row and column intervals
var elipse_top = 1;
var elipse_left = 1;
var elipse_bottom = 9;
var elipse_right = 9;
var elipse_row_interval = 10;
var elipse_column_interval = 10;

// store total rows and columns required
var total_rows_required = Math.floor(doc.width / elipse_row_interval);
var total_columns_required = Math.floor(doc.height / elipse_column_interval);

// initiate counters for rows and columns
var row_count = 0;
var column_count = 0;

while (column_count < total_columns_required) {


while (row_count < total_rows_required) {

// activate the bottom layer (the "original image" layer)
doc.activeLayer = doc.artLayers[doc.artLayers.length - 1];

// set the selection parameters
top_s = elipse_top + (column_count * elipse_column_interval);
left_s = elipse_left + (row_count * elipse_row_interval);
bottom_s = elipse_bottom + (column_count * elipse_column_interval);
right_s = elipse_right + (row_count * elipse_row_interval);

// make the selection
// ELIPSE
makeSelection (top_s, left_s, bottom_s, right_s, true);
// RECTANGLE
// makeSelection (top_s, left_s, bottom_s, right_s, false);

// average the selection
doc.activeLayer.applyAverage();

// apply gaussian blur to the selection
// THIS IS ONLY NECESSARY IF THERE ARE TRANSPARENT AREAS ON THE ORIGINAL IMAGE
// if this method is used it's necessary to make multiple copies (approx 10)
// of the finished dot layer and merge them down in order to make the dots opaque
// UNCOMMENT THE NEXT LINE TO APPLY GAUSSIAN BLUR
// doc.activeLayer.applyGaussianBlur(1.7);

// copy the averaged selected area of the "original image" layer
doc.selection.copy();

// undo the changes to the "original image" layer
doc.activeLayer = doc.artLayers[1];
undoImageChange();

// paste the copied area INTO THE SELECTION on a new layer
doc.paste(true);

// apply the layer mask
applyLayerMask();

// set the layer's opacity
doc.activeLayer.opacity = 100.0;

// merge the new layer with the "dot" layer
doc.activeLayer = doc.artLayers[0];
doc.activeLayer.merge();

// increment the row counter
row_count += 1;

}

// reset row_count
row_count = 0;

// increment the column_count
column_count += 1;

}


// ------------------------------------------------------------------------------------------------
// CLEAN UP AND RESET THE DOCUMENT
// ------------------------------------------------------------------------------------------------

// release references
doc = null;
dotLayer = null;
pasteToLayer = null;

// restore original ruler unit setting
app.preferences.rulerUnits = originalRulerUnit;

Edit:
Ashally I don't use this very often any more, I found a way around most of it immediately after writing it, duh.
And it's only a starting point to generate the the 'dots'... it's mainly offset layers and blending modes after that.
(, Mon 5 Feb 2007, 5:48, archived)
# Code!
(, Mon 5 Feb 2007, 5:58, archived)
# Ugh.
 
What syntax is that?

Java? C? PHP?

I should recognise it but I don't.
(, Mon 5 Feb 2007, 6:00, archived)
# It's Javascript.
It turns out you can script photoshop.
I was after a particular effect and wrote this, which work pretty well but very slowly.
Then about an hour after finishing it, I found a really quick way to achieve most of what this can do without any code at all.
I still use it sometimes though, there are a couple of things it can do that are difficult to achieve in other ways.
It's only really a starting point, but it was actually kind of fun to write, just as an exercise in scripting something other than a browser or a flash movie.
(, Mon 5 Feb 2007, 6:03, archived)
# So, that's a neato?
 
If I had photoshop, I'd definitely play around with it.
(, Mon 5 Feb 2007, 6:18, archived)
# error on line 49
(, Mon 5 Feb 2007, 6:01, archived)
# Pffft.
(, Mon 5 Feb 2007, 6:03, archived)
# s'true
while(doc.artLayers.length 1){
(, Mon 5 Feb 2007, 6:05, archived)
# Looks like it.
edit: on looking at it some it will
still run correctly, as javascript
will bail early (doc.artLayers.length
at zero) before resolving the "1)".
(, Mon 5 Feb 2007, 6:10, archived)
#
(, Mon 5 Feb 2007, 6:14, archived)
# Hehe! Filters!
Funny that, in the case picked, it
would have worked with some parsers.

Been meaning to play with scripting PS.
thx for the post/code snippet.
(, Mon 5 Feb 2007, 6:24, archived)
# Check out the scripting listener plugin
and the adobe photoshop scripting forum. Both very helpful.
(, Mon 5 Feb 2007, 6:27, archived)
# Heh
ah, found and fixed
There may be a few other < and > missing
(, Mon 5 Feb 2007, 6:11, archived)
# that figures
(, Mon 5 Feb 2007, 6:16, archived)
# where would you score
in a landscape like that
& like taht
(, Mon 5 Feb 2007, 5:51, archived)
# high crime zone...
...in the city of lights...
(, Mon 5 Feb 2007, 5:37, archived)
# WY
(, Mon 5 Feb 2007, 5:47, archived)
# OI I like this picture
your bollock load of code is not needed

I would woo the picture but the code severely detracted from it
(, Mon 5 Feb 2007, 6:00, archived)
# Pfft
these pics are the only ones I ever use code in, and if you wanted to make something similar you could use that code as a starting point.
I'm sorry it upset you, though I don't understand why it should, or why it would change your perception of the pic. You could always hide the post I guess.
(, Mon 5 Feb 2007, 6:08, archived)
# this silly amount of
(, Mon 5 Feb 2007, 6:14, archived)
# The thing is
if you know how to use it you could make something with it. It's exactly the same as sharing a technique... think of it as a very precise tutorial, if that makes you feel any better.
Again, sorry it pissed you off.
(, Mon 5 Feb 2007, 6:17, archived)
# DAMN, YOU'RE ONE PLEASANT MOTHERFUCKER.
(, Mon 5 Feb 2007, 6:19, archived)
# TOTALLY. THERE WAS THIS ONE TIME WHEN THIS PUNK WAS ALL UP IN HIS FACE LIKE 'UHHHHHH' AND MOFAHA WAS ALL LIKE 'JUST CHILL OUT MAN, YOU NEED TO RELAX'.
(, Mon 5 Feb 2007, 6:21, archived)
# I LOOSENED THOSE BONDAGE PANTS AND WE SHARED CAKE
WHY CAN'T WE ALL JUST GET ALONG
(, Mon 5 Feb 2007, 6:23, archived)
# If there is an argument that can't be resolved with the sharing of cake and the loosening of bondage pants, I'm not aware of it.
Except maybe "These bondage pants are too loose" or "I'm sick of eating cake" or "These bondage pants are too loose and I'm sick of eating cake"

Other than that, it's sweet.
(, Mon 5 Feb 2007, 6:30, archived)
# Let's all have a quiet moment and think about Robert Snug.
(, Mon 5 Feb 2007, 6:22, archived)
#
 

 
(, Mon 5 Feb 2007, 6:30, archived)
# Calm down dear
(, Mon 5 Feb 2007, 6:19, archived)
#
 

 
(, Mon 5 Feb 2007, 6:23, archived)
#
(, Mon 5 Feb 2007, 6:25, archived)
# AROOOOOOOOOOOOOOOO!
(, Mon 5 Feb 2007, 6:25, archived)
# Chump!
(, Mon 5 Feb 2007, 6:27, archived)
# yo
not this piece in particular, but I just realized that most of your work reminds me of Andy Worhal.
(, Mon 5 Feb 2007, 6:01, archived)
# I need a code
?
(, Mon 5 Feb 2007, 6:17, archived)
# Nah
there's other ways to do this. I'm not posting any more detailed info though or neon blue will kill me to fucking bits.
(, Mon 5 Feb 2007, 6:29, archived)