Despite the Bitmap API in Flash 8, I'd still recommend to use the GD
library of PHP to do this, mainly for saving the resulting mosaic. 
Either way, you'll have to:

- 'homogenize' the size of the images in the pool. They will come in
different orientations and sizes now, but in the end you have to map
them to one of the square-shaped pixels in the target image. Cut out the
central square part and size each to e.g. 100x100 pixels.

- store the average color of each picture in a database. Get the average
color by scaling a copy of the image down to 1x1 pixel, GD (or Flash)
will do the work of calculating the average value. You may get better
results by scaling down in several steps.

- the average color is a value between 0 and > 16 millions - but the
pool consists of only 3'000 images. To find a match for each pixel in
the target image we'll not be able to work with identical colors, we'll
have to find similar colors. Finding the closest 'websafe' color might
be a good approach:
http://chattyfig.figleaf.com/pipermail/flashcoders/2005-July/143567.html

Now that the we have indexed all images and saved their average color in
the db, we can take any other image, iterate through each pixel, get its
color (probably convert to 'websafe'), search the db for images with
matching colors, randomly select one of them, add it to the big,
emerging mosaic.

Be aware that these operations are very heavy on any processor (after
indexing several ten-thousands 'googled' images, my ISP disabled the PHP
script because it ate to many processor cycles...)

If you do not need to do this 'on the fly' (and prepare for a rather
slow flight...) I don't see a good reason why you would want to program
this yourself - there are several programs, even free ones, out there
(google).

hth
--------------
Andreas Weber
motiondraw.com


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Corban
Baxter
Sent: Dienstag, 17. Januar 2006 22:32
To: Flashcoders mailing list
Subject: RE: [Flashcoders] photo mosaics


No one has replied to this post of mine so I am wondering if there is a
better way to describe what I am doing could it be some thing else I
need to look into first to accomplish this? Thanks!

Corban Baxter


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Corban
Baxter
Sent: Tuesday, January 17, 2006 11:50 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] photo mosaics

Hey guys do you all by chance remember seeing a site that used flash to
create photo mosaics of an image you upload to the site. I am looking to
do the same thing but I am not sure where to start. I have this database
with about 3,000 images I'd like to use to make photo mosaics out of.
Does anyone remember the site for one and for two know of any tutorials
that would get me started in creating this application. Thanks for the
help everyone!

Corban Baxter


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to