Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Photo mosaic


  • Please log in to reply
20 replies to this topic

#1 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 723 posts

Posted 01 November 2010 - 07:28 AM

No explanation needed. Title says it all:

AutoIt         
#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, 01 November 2010 - 07:55 PM.








#2 fighter1

fighter1

    Seeker

  • New Members
  • 4 posts

Posted 01 November 2010 - 08:30 AM

Simple and wonderful ... Thank you :graduated:

#3 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 723 posts

Posted 01 November 2010 - 08:46 AM

Thanks! There is a big poster on the front building, with loads of photos overlapping together, so I thought it would be nice to make one with my photos too.  :graduated:

#4 somdcomputerguy

somdcomputerguy

  • Active Members
  • PipPipPipPipPipPip
  • 2,640 posts

Posted 01 November 2010 - 01:28 PM

Simple and wonderful ... Thank you :graduated:


Ya. What he said!

- Bruce /* somdcomputerguy */  If you change the way you look at things, the things you look at change.


#5 Skrip

Skrip

    Psychonaut

  • Active Members
  • PipPipPipPipPipPip
  • 2,346 posts

Posted 01 November 2010 - 03:06 PM

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

We're trapped in the belly of this horrible machine.And the machine is bleeding to death...


#6 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 723 posts

Posted 01 November 2010 - 04:08 PM

Skrip, replace 

@ScriptDir&"\Foto\"

with a path to a directory with photos.


M.I.

[EDIT] Updated first post (error checking)

Edited by taietel, 01 November 2010 - 04:14 PM.


#7 somdcomputerguy

somdcomputerguy

  • Active Members
  • PipPipPipPipPipPip
  • 2,640 posts

Posted 01 November 2010 - 04:15 PM

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 /* somdcomputerguy */  If you change the way you look at things, the things you look at change.


#8 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 723 posts

Posted 01 November 2010 - 04:21 PM

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

#9 eracross

eracross

    Wayfarer

  • Active Members
  • Pip
  • 57 posts

Posted 01 November 2010 - 05:51 PM

Not working on vista? nothing appears..

#10 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 723 posts

Posted 01 November 2010 - 05:55 PM

eracross, I've tested on Win7/32 and XPsp3/32 and it works. You have to change in the script where I've wrote ";<<<<<<<".

#11 eracross

eracross

    Wayfarer

  • Active Members
  • Pip
  • 57 posts

Posted 01 November 2010 - 05:59 PM

I did the image wont appear..

#12 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 723 posts

Posted 01 November 2010 - 06:10 PM

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:

Spoiler




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

Edited by taietel, 01 November 2010 - 06:16 PM.


#13 eracross

eracross

    Wayfarer

  • Active Members
  • Pip
  • 57 posts

Posted 01 November 2010 - 06:22 PM

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

#14 JohnOne

JohnOne

    John

  • Active Members
  • PipPipPipPipPipPip
  • 11,256 posts

Posted 01 November 2010 - 07:44 PM

For example purpose, perhaps yopu should change the line
Local $PathToPhotoDir = @ScriptDir&"\Foto\"
with
Local $PathToPhotoDir = FileSelectFolder("Select Folder","") & "\"

#15 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 723 posts

Posted 01 November 2010 - 07:54 PM

Thanks John,

I've modified it (first post). For example purpose is indeed more handy than modifying the script.

#16 Skrip

Skrip

    Psychonaut

  • Active Members
  • PipPipPipPipPipPip
  • 2,346 posts

Posted 01 November 2010 - 09:35 PM

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


Ah, much better! That is awesome!

We're trapped in the belly of this horrible machine.And the machine is bleeding to death...


#17 JScript

JScript

    I'm back ... I miss, why not!

  • Active Members
  • PipPipPipPipPipPip
  • 1,070 posts

Posted 03 November 2010 - 02:38 AM

@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://notebook.forumais.com (Forum Maintenance Notebooks and Desktop)http://autoitbrasil.com/ (AutoIt v3 Brazil!!!)
Spoiler

Posted Image Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!       


#18 1957classic

1957classic

    Seeker

  • Active Members
  • 21 posts

Posted 03 November 2010 - 04:45 AM

Nice script!
Works great on Win7/64

#19 SUB0DH

SUB0DH

    Seeker

  • Active Members
  • 8 posts

Posted 04 November 2010 - 08:58 AM

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.

#20 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 723 posts

Posted 04 November 2010 - 09:23 AM

1957clasic, it's good to know! I'm on 32 (XP and 7) and no chance to test it myself..

SUB0DH, I know that. The script posted is just an example. Rest is up to you.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users