Creator:  Shanfan Huang
Date:  16. November 2011, 09:40

This script generates a hexagonal grid then fills the color from an underlying rasterized image. So you first place an image with in the artboard, and rasterize it. Then execute the script.

The blurry photo I used here is from Yunyunsarang Deviantart.

*** JAN 4 2012 *** IMPORTANT UPDATE ***
Upon seeing so many bug reports, I decided to write a more user friendly Grid Generator that focuses on the grid, nothing else. Hope this would resolve the issue and happy new year every one! :)

This image is modified in Photoshop.
The original image and the hexagonal grid.
Re: Hexagonal Grid Generator
From:  Maks
Date:  25. November 2011, 11:27

wow
IloveIt

Re: Hexagonal Grid Generator
From:  Andy
Date:  29. November 2011, 23:02

I placed an image in Illustrator - a jpeg. I then "rasterized" it. While it's still selected, I ran the script and I got an error. Then I tried just making a shape in Illustrator and rasterizing and running the script. I still get an error. Can you give me a step by step of how to use this? Cool script idea though. The example looks awesome!

Re: Hexagonal Grid Generator
From:  Shanfan Huang
Date:  3. December 2011, 19:37

Thanks for downloading! :)
You shouldn't keep the rasterized image selected though... I think I coded so that the script will select the image on its own.

Step by step on how I did the showcase picture:

1. place an image within the 'artboard', and make sure it's a bit bigger than the artboard size.

2. rasterize the image. (Menu- Object>Rasterize...). Don't keep the image selected.

3. Create a new layer on top of the image layer and keep this layer highlighted.

4. Run the script.

5. Turn off the visibility of the image layer.

==== It's done! But if you want to spice it up, here are some ingredients ====

* Fiddle with the stroke color and stroke width.
* Run the script again on a new layer, (or with a different image) and play with the layer transparency mode.
* Export to Photoshop and have fun ;)

Re: Hexagonal Grid Generator
From:  Simon
Date:  15. December 2011, 03:32

This doesn't work at all for me on CS4 / 64bit Windows 7, even following the steps above. I always get the error message. If I keep the rastered image selected, then the hexagons end up all white; if I use layers and deselect the raster, then the selected top layer does nothing and no hexagons are created at all. Shame, because this looks like it could have been an awesome script!

Re: Hexagonal Grid Generator
From:  Shanfan Huang
Date:  20. December 2011, 06:20

Can you attach a screenshot of the error message?

It's worked fine on CS5/mac leopard, with or without selecting the rasterized image.
It could be a CS version compatible issue though...

Re: Hexagonal Grid Generator
From:  Dominik
Date:  3. January 2012, 22:06

I have the same problem. I attached a screenshot. Please help.

Re: Hexagonal Grid Generator
From:  Shanfan Huang
Date:  3. January 2012, 23:01

Where can I see the screenshot?
If possible, please crop the whole screen of Adobe working area.

Re: Hexagonal Grid Generator
From:  T. B.
Date:  6. January 2012, 11:56

Nope! I'm on CS4 and Win XP (I know...). I get the following error message:

Error 2: document is undefined.
Line: 17

  • > var center=document.bounds.topleft

Any idea?

Re: Hexagonal Grid Generator
From:  Shanfan Huang
Date:  10. January 2012, 06:52

I see. It's because the script couldn't define where the Artboard is. The easiest fix is to define a point for it. Change that line into:

var center = {x:0, y:0};

It should work now. x and y can be any number you want. It's the starting location to place the first hexagon.

Let me know :)

Re: Hexagonal Grid Generator
From:  Dominik
Date:  10. January 2012, 11:22

The error has gone but there's next:

Error 2: Path is undefined.

Line: 18

  • > var myHex = new Path.RegularPolygon(center, 6, gridSize/2);

I'm using Illustrator CS5.1