Sign in to follow this  
Followers 0

Photo mosaic

21 posts in this topic

#1 ·  Posted (edited)

No explanation needed. Title says it all:

#include <GUIConstantsEx.au3>
#Include <File.au3>

GUICreate("Photo Mosaic", 800, 600)
_GenerateMosaic(800,600)
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _GenerateMosaic($iW, $iH, $iX=0,$iY=0)
    Local $PathToPhotoDir = FileSelectFolder("Select Folder","") & "\"
    If @error then Exit
    $arPhoto = _FileListToArray($PathToPhotoDir,"*.jpg",1)
    If @error then
        MsgBox(0,"ERROR:","Replace @ScriptDir&'\Foto\' with your path to the photo directory!")
        Exit
    EndIf
    GUICtrlCreatePic($PathToPhotoDir&$arPhoto[1], $iX, $iY, $iW, $iH);first photo as background
    GUICtrlSetState(-1, $GUI_DISABLE)
    SplashTextOn("", "Wait!"&@LF&"generating mosaic...", 240, 60, -1, -1, 1+32, "Tahoma", 12,800)
    For $i=1 To 10;number of passes
        $n = Random(-100,100,1)
        For $j=1 To UBound($arPhoto)-1; be careful with the array; the bigger it is, the longer you wait!
            $xx = Random($iX,$iW,1)
            $yy = Random($iY,$iH,1)
            $Pic1 = GUICtrlCreatePic($PathToPhotoDir&$arPhoto[$j], $xx-$n, $yy-$n, 102.4+$n, 76.8+$n)
        Next
    Next
    SplashOff()
EndFunc
   Edited by taietel

Share this post


Link to post
Share on other sites



#2 ·  Posted

Simple and wonderful ... Thank you :graduated:

Share this post


Link to post
Share on other sites

#4 ·  Posted

Simple and wonderful ... Thank you :graduated:

Ya. What he said!


- Bruce [font="'Lucida Console';"]/*somdcomputerguy */  If you change the way you look at things, the things you look at change.[/font]

Share this post


Link to post
Share on other sites

#5 ·  Posted

This seems pretty cool, however it does not actually generate any images. It say's "Please wait, generating", then the GUI is empty.


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

#7 ·  Posted

Skrip, replace

@ScriptDir&"\Foto\"

with a path to a directory with photos.

M.I.

And don't forget, do it twice! At the $arPhoto and $Pic1 definitions.


- Bruce [font="'Lucida Console';"]/*somdcomputerguy */  If you change the way you look at things, the things you look at change.[/font]

Share this post


Link to post
Share on other sites

#9 ·  Posted

Not working on vista? nothing appears..

Share this post


Link to post
Share on other sites

#11 ·  Posted

I did the image wont appear..

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

When you run it it will appear a slash text ("Wait! generating mosaic...") and after few seconds the gui with the images overlapped.

Something like this:

http://img840.imageshack.us/img840/1531/mosaicju.jpg

The script uses jpg's, but you can add bmp's also.

Edited by taietel

Share this post


Link to post
Share on other sites

#13 ·  Posted

Oh i see it wont work with 2 photos..needs more pics.hehe thanks nice work

Share this post


Link to post
Share on other sites

#14 ·  Posted

For example purpose, perhaps yopu should change the line

Local $PathToPhotoDir = @ScriptDir&"\Foto\"

with

Local $PathToPhotoDir = FileSelectFolder("Select Folder","") & "\"


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#16 ·  Posted

somdcomputergui, done! :graduated: Remains only one place to replace (updated first post).

Ah, much better! That is awesome!


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

#17 ·  Posted

@taietel

Magnificent! Are you just keep proving that creativity and imagination to do a thousand things with a simple code. This forum needs people like you, keep it up; You're the man!


http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

#18 ·  Posted

Nice script!

Works great on Win7/64

Share this post


Link to post
Share on other sites

#19 ·  Posted

Nice work.

I think it would be better if the generated mosaic could be saved as an image. It would also be better if images used in the mosaic wouldn't repeat itself.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0