Discussion:
plugin for creating halftone/array of small objects to approximate an underlying object
(too old to reply)
T***@adobeforums.com
2006-12-25 11:32:28 UTC
Permalink
I’m looking for a convenient way to approximate either a bitmap or vector with an array or halftone pattern of smaller objects. For example if I have a picture of a black cow on a white background, the plugin (or whatever) creates a kind of halftone of black dots (or object that I choose) to over the cow and white dots over background. I can do this manually but it’s quite time consuming.
J***@adobeforums.com
2006-12-25 16:18:17 UTC
Permalink
In my playing around with AI Javascripts, one of the ideas which occasionally occurs to me, but which I haven't had opportunity to try is this:

1. Draw a small black circle and store it as a Symbol.

2. Select a grayscale image. Filter>Create>Object Mosaic. Select Gray for the Result. This creates a Group of square vector paths, each filled with a tint of black. Ungroup.

3. This is where a Javascript would come in. The Javascript would loop through the current selection, doing this for each:

a. Get the path's fill color.
b. Get the path's X and Y positions.
c. Get the path's height and width.
d. Add an Instance of the dot Symbol.
e. Position the Instance to the path's X and Y.
f. Set the Instance's height and width to those of the path.
g. Scale the Instance about its center by the same value as the path's fill.

4. Having done this, you could then use the Replace Symbol command to swap all the Instances for Instances of any other Symbol in one go. So you could render your grayscale cow with dots made of any Symbol.

Of course, in all such fake halftone attempts, you have to bear in mind, the result is not really going to be like a true halftone. For example, in the above approach, a round dot the same size a black square is not going to give you what amounts to a 100% tint of black, because there will be gaps between adjacent black circles. (That is an oft-overlooked aspect of halftoning--dots don't just change size; they change shape, too.)

Still, it might work acceptably for some interesting effects, depending upon the original image and the amount of detail expected.

JET
J***@adobeforums.com
2006-12-26 02:22:53 UTC
Permalink
I have never used this, but you might try the Scriptographer plug-in:

<http://www.scriptographer.com/>

<http://www.scriptographer.com/Scripts/Raster+Scripts/>
T***@adobeforums.com
2006-12-26 03:09:34 UTC
Permalink
Hadnt noticed that create mosaic command before. I guess that's the key. Now to figure out the scripting of the rest, that's the hard part... especially when I can't write scripts from scratch, only edit them!
t***@adobeforums.com
2006-12-26 05:26:22 UTC
Permalink
only thing I have ever seen that produces VECTOR halftones (using, circles, sqaures, diamonds, ellipses, lines etc) is a little pricey but nit too pricey... www.cocut.com (Cocut PRO).

it's a sign cutting program and quite excellent...but takes some getting used too getting the result you want.

but it does create VECTOR halftones...not bitmap.

you could also maybe do the same using photoshop halftone filter at a very high resolution...then vector trace it using AICS2.
J***@adobeforums.com
2006-12-27 06:05:52 UTC
Permalink
Here's an attempt at the routine I described above, using Create Object Mosaic, a (rough) Javascript, and a Symbol Instance:



A PDF explaining it is here:

<http://www.IllustrationETC.com/AIbuds/AI_FauxHalftone/AI_FauxHalftone.pdf>

(13 pages. 3MB)

The script is here:

<http://www.IllustrationETC.com/AIbuds/AI_FauxHalftone/JET_FauxHalftone.zip>

JET
t***@adobeforums.com
2006-12-27 13:52:28 UTC
Permalink
wow jet!

nice!

THANX!
t***@adobeforums.com
2006-12-27 14:09:18 UTC
Permalink
you know what would also be cool... something along the same lines you created but creates using the mesh tool? whereas each meshpoint automatically gets the color sampled from the image below? just an idea.
J***@adobeforums.com
2006-12-27 18:55:31 UTC
Permalink
Play with using it for other things, too. Try this:

1 Spiral Tool: Draw a simple spiral.
2. Make a copy of it and scale it down to about a quarter inch.
3. Drag the small spiral to the Symbols Palette.
4. Apply a tapered ArtBrush to the large spiral.
5. Effect>Blur>Gausian Blur
6. Object>Rasterize
7. Filter>Create>ObjectMosaic.
8. Run the script.



9. Use Replace Symbol to replace the Dots with the small spiral Symbol. Now you have a spiral of spirals. (First image, below)

10. Object>Transform>TransformEach. Turn on the Random checkbox. Set both scale fields to something like 300%. Set rotation to 360. (Middle image, below)

11. I used another Javascript, JET_RandomReplaceSymbol, to randomly swap each Instance with other Symbols in the current Symbols Palette. (Lower image, below)



JET
Teri Pettit
2006-12-27 19:05:20 UTC
Permalink
you know what would also be cool... something along the same lines you
created but creates using the mesh tool? whereas each meshpoint automatically
gets the color sampled from the image below?




Tim, the Gradient Mesh>Make command already does that kind of mosaic if you have an image object selected when you invoke it. (Of course, you would have to duplicate the image to avoid converting the original.)

As for a non-mosaic mass extraction of image colors onto mesh nodes that were manually placed by the artist, that's something I'd like to have too:

<http://www.adobeforums.com/cgi-bin/webx/.3bbcdb84/1>

(See also posts 171 and 193 in the same thread.)
J***@adobeforums.com
2006-12-27 19:52:10 UTC
Permalink
I don't think the AI Javascript implementation provides any access to individual MeshPoints or their properties.

JET
K***@adobeforums.com
2006-12-28 22:37:24 UTC
Permalink
Well done, James. A good alternative in addition to the Scriptographer solution mentioned above.
t***@adobeforums.com
2006-12-29 05:14:16 UTC
Permalink
very nice...very talented... you programmers blow my mind.
loic_aigon
2007-07-10 14:09:28 UTC
Permalink
Wow, the result you get opens a very wide range of possibilities.
However, i can't obtain any result although it seems i follow very carefully your instructions. The script seems to go running well, but when it has finished, no frames were replaced by the Dot symbol.
What may i did wrong ?
Thanks Loic
J***@adobeforums.com
2007-07-11 02:09:16 UTC
Permalink
In the Object Mosaic dialog, be sure to select Gray for Result, not Color.

JET
loic_aigon
2007-07-11 08:50:32 UTC
Permalink
Hi James,
In this right moment, the script is running well. I don't understand why I experienced these difficulties yesterday. I was certainly misdoing something. Dont take too attention to the rest of the message. Before the script finally worked, i was explaining what I was experiencing. So you may want to read it for info but you don't really need to.
Thanks a lot and congratulations for your script, it's marvellous and the fact that is free really honors you.
Loic

I chose gray result.
But when I launch the script, ESTK returns undefined.
I activated the alert you placed to have a look on what was happening & it said that currFill is not a number.
When i ask for seeing what is the fillColor of a selected frame(app.activeDocument.selection[0].fillColor.gray), it replies undefined.
Doing the same with app.activeDocument.selection[0].fillColor, replies [CMYKColor].
It looks like the script couldn't obtain a number from currFill.
I tested all on ESTK 1.0.3 and Illustrator CS2 but recently installed Illustrator CS3 with ESTK 2. Maybe some instructions have been messed in the process.
J***@adobeforums.com
2007-07-11 11:43:23 UTC
Permalink
It looks like the script couldn't obtain a number from currFill.




Sounds like you had forgotten to Ungroup the results of the Object Mosaic filter. If the selection is left as a Group, the Group will not have a fill, therefore the error.

JET
loic_aigon
2007-07-11 12:29:48 UTC
Permalink
Hi James,
You must be right or the script wouldn't have suddenly worked this morning. Thanks for your time & hearing.
PS : talking about the script that may not understand currfill, was not made to insinuate anything wrong with your work. I just wanted to be the most clearer as possible to help you help me :-)
I was just trying to understand by myself what I did wrong.
By the way, you're right. Looking at the script running is cool.
Loic
J***@adobeforums.com
2009-03-23 11:19:51 UTC
Permalink
Anoher one back from the abyss.
Jay Jhabrix
2009-03-23 18:10:52 UTC
Permalink
Ah Jacob!

Cheers!

JJ

Loading...