Jump to content

Art Generator!


Joke758
 Share

Recommended Posts

Here a script to make nice TOTALLY random design.

;By Joke758
Global $bites = 200000
Global $temp
;JPG header
Global $hex = 'FFD8FFE000104A46494600010101006000600000FFDB0043000806060706050807070'& _
'70909080A0C140D0C0B0B0C1912130F141D1A1F1E1D1A1C1C00242E2700222C23'& _
'1C1C2837292C30313434341F27393D38323C2E333432FFDB0043010909090C0B0C1'& _
'80D0D1832211C213232323232323232323232323232323232323232323232323232323'& _
'232323232323232323232323232323232323232323232FFC00011080248038103012200'& _
'021101031101FFC4001F000001050101010101010000000000000000010203040506070'& _
'8090A0BFFC400B5100002010303020403050504040000017D01020300041105122131'& _
'410613516107227114328191A1082342B1C11552D1F02433627282090A161718191A2'& _
'5262728292A3435363738393A434445464748494A535455565758595A6364656667686'& _
'96A737475767778797A838485868788898A92939495969798999AA2A3A4A5A6A7A8'& _
'A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE'& _
'1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC4001F01000301010101010101'& _
'01010000000000000102030405060708090A0BFFC400B5110002010204040304070504'& _
'0400010277000102031104052131061241510761711322328108144291A1B1C1092333'& _
'52F0156272D10A162434E125F11718191A262728292A35363738393A4344454647484'& _
'94A535455565758595A636465666768696A737475767778797A82838485868788898A'& _
'92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5'& _
'C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9'& _
'FAFFDA000C03010002110311003F00F7FA2800'


$Form1 = GUICreate("Creating", 237, 74)
$Progress2 = GUICtrlCreateProgress(16, 40, 209, 17)
GUICtrlSetColor(-1, 0x316AC5)
GUICtrlCreateLabel("Creating...", 16, 8, 97, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)

;Making the body of the jpg
Msgbox ( 0, "hey", _RandomBytes())
$rand = _RandomBytes()
For $za = 1 to $bites Step 16
    For $i = 1 to 16 Step 2
        $temp = StringMid ( $rand, $i, 2 )
        $hex &= $temp
        $percent = int(($za/$bites)*100)
        GuiCtrlSetData ( $progress2, $percent )
    Next
Next
GuiDelete ( $form1 )

;modify
$hex = '0x' & $hex

;saving
Local $h_Open = FileOpen('output.jpg', 2)
FileWrite($h_Open, BinaryString($hex))
FileClose($h_Open)
run("rundll32.exe shimgvw.dll,ImageView_Fullscreen " & @scriptdir & "output.jpg") ;Thanks to daslick
MsgBox ( 64, "Art Generator", "Done!" & @CRLF & @scriptdir & "output.jpg" )
    
Func _RandomBytes()
    Local $hx_Return
    
    For $i = 1 to 16
        $hx_Return &= Hex(Round(Random ( 0, 255 )),2)
    Next
    
    Return $hx_Return
EndFunc

It can look like this:

Posted Image

or this:

Posted Image

Posted Image

Posted Image

Edited by Joke758

[u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own!

Link to comment
Share on other sites

  • Replies 62
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

I understand you /dev/null, crystal clear. I think it's impossible to plot exactly what we want, because jpeg compression algorithm uses not single "pixel entries" but parts of the picture. It's like trying to paint Mona Lisa without looking at the canvas. But I was trying to show, that certain parts can be repeated.

Link to comment
Share on other sites

Posted Image

Here's a bmp generator, but it's hard to generate BMP cause they only contain 00 and FF.

;By Joke758
Global $bites = 1572128
Global $temp
;BMP header
Global $hex = '424D56FD17000000000036000000280000008103000048020000010018000000000020'& _
'FD170000000000000000000000000000000000'
Dim $c[7]
$c[0] = 6
$c[1] = '00FF00' ;Green
$c[2] = 'FFFF00' ;Yellow
$c[3] = 'FF0000' ;Blue
$c[4] = 'FFFFFF' ;White
$c[5] = '0000FF' ;Red
$c[6] = '000000' ;Black


$Form1 = GUICreate("Creating", 237, 74)
$Progress2 = GUICtrlCreateProgress(16, 40, 209, 17)
GUICtrlSetColor(-1, 0x316AC5)
GUICtrlCreateLabel("Creating...", 16, 8, 97, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)

;Making the body of the jpg
For $a = 1 to $bites Step 3
        $temp = $c[Round(Random(1,$c[0]))]
        $hex &= $temp
        $percent = int(($a/$bites)*100)
        GuiCtrlSetData ( $progress2, $percent )
Next
GuiDelete ( $form1 )

;modify
$hex = '0x' & $hex & "00"

;saving
Local $h_Open = FileOpen('output.bmp', 2)
FileWrite($h_Open, BinaryString($hex))
FileClose($h_Open)
run("rundll32.exe shimgvw.dll,ImageView_Fullscreen " & @scriptdir & "output.bmp") ;Thanks to daslick
MsgBox ( 64, "Art Generator", "Done!" & @CRLF & @scriptdir & "output.bmp" )

[u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own!

Link to comment
Share on other sites

i created this

post-9526-1168042719_thumb.jpg

(blown up to 800% and converted to jpg for file size)

with

For $a = 1 to $bites Step 3
        $temp = Hex(BitAND(Tan(Sin(Cos($a)))*97, Cos(Tan(Sin($a)))*103),6) ;$c[Round(Random(1,$c[0]))]
        $hex &= $temp
        $percent = int(($a/$bites)*100)
        GuiCtrlSetData ( $progress2, $percent )
Next
Edited by smstroble

MUHAHAHAHAHA

Link to comment
Share on other sites

Hey that's nice!

[u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own!

Link to comment
Share on other sites

PNG Header with some byte:

Global $hex = '89504E470D0A1A0A0000000D494844520000038100000248080200000050587653000'& _
'000017352474200AECE1CE90000000467414D410000B18F0BFC61050000002063485'& _
'24D00007A26000080840000FA00000080E8000075300000EA6000003A98000017709'& _
'CBA513C000088FB49444154785EED9D8992EB3A8E6D6FFFF9F9F3EAF4904E59A'& _
'248CC04C8ED38F1FAD54D0EE002086E4192FD7FFFFBDFFFFEC307044000041625'& _
'F07F87756D92EC7E96BCC94A178D592C0B04B621F0A341F101011000819508FCF7'& _
'7369FDFB6FA57511D7F2B3767C40000440203F0124ABFC3E828520000263029BEB'& _
'CE132064F671C4A0050880C06C02C854B33D80F9410004A404A03B3BE490DCA5'

[u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own!

Link to comment
Share on other sites

They do start with 8 bytes. Wikipedia has information on png's - http://en.wikipedia.org/wiki/Png

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

They indeed start with 8 bytes, but like I said, I added some bytes for the picture resolution (897x584) and everything.

PNG Header with some byte:

You cannot add random byte to the 8-bytes header of PNG because you have to definite the resolution.

[u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own!

Link to comment
Share on other sites

Exactly :P

But it gives crappy result..

[u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own!

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...

Nice program but your program could make the picture in 60% of the time.

(You waste a lot of time updating the progress bar every loop, and calculating the percentage. There is a better way by only doing it every 1%)

Also when the image has been made it would be better to show the image.

Run time (bites=100000)

Original program: 5.2 secs (5158.60451537835 ms)

Improved program: 3.3 secs (3273.30233311776 ms)

Improved program takes 64% of the time that the old one takes

Make cool jpg file with my generator!

You can choose the size of the file. Default is 100kb.

<code was here>

Here's an example:

http://img88.imageshack.us/img88/2554/outputld5.jpg

;By Joke758
Global $bites = IniRead ( "artgen.ini", "bites", "bites", "100000" )

;JPG header
Global $hex = 'FFD8FFE000104A46494600010101006000600000FFDB0043000806060706050807070'& _
'70909080A0C140D0C0B0B0C1912130F141D1A1F1E1D1A1C1C00242E2700222C23'& _
'1C1C2837292C30313434341F27393D38323C2E333432FFDB0043010909090C0B0C1'& _
'80D0D1832211C213232323232323232323232323232323232323232323232323232323'& _
'232323232323232323232323232323232323232323232FFC00011080248038103012200'& _
'021101031101FFC4001F000001050101010101010000000000000000010203040506070'& _
'8090A0BFFC400B5100002010303020403050504040000017D01020300041105122131'& _
'410613516107227114328191A1082342B1C11552D1F02433627282090A161718191A2'& _
'5262728292A3435363738393A434445464748494A535455565758595A6364656667686'& _
'96A737475767778797A838485868788898A92939495969798999AA2A3A4A5A6A7A8'& _
'A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE'& _
'1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC4001F01000301010101010101'& _
'01010000000000000102030405060708090A0BFFC400B5110002010204040304070504'& _
'0400010277000102031104052131061241510761711322328108144291A1B1C1092333'& _
'52F0156272D10A162434E125F11718191A262728292A35363738393A4344454647484'& _
'94A535455565758595A636465666768696A737475767778797A82838485868788898A'& _
'92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5'& _
'C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9'& _
'FAFFDA000C03010002110311003F00F7FA2800'
$Form1 = GUICreate("Creating", 237, 74, 302, 218)
$Progress2 = GUICtrlCreateProgress(16, 40, 209, 17)
GUICtrlSetColor(-1, 0x316AC5)
GUICtrlCreateLabel("Creating...", 16, 8, 97, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)


;Making the body of the jpg
$one_percent=round($bites/100) ; Updating every 1% only (it is displayed like this anyway) makes the program run a lot faster - Adam1213
For $a = 1 to $bites
    if mod($a, $one_percent)=0 then ; Update only every 1% - Adam1213 then
        GuiCtrlSetData ($progress2, $a/$one_percent); - remove round as its not needed -theguy0000 
    endif
    $hex &= Hex(Random ( 0, 255 ), 2)
Next
GuiDelete ( $form1 )

;modify
$hex = '0x' & $hex

;saving
Local $h_Open = FileOpen('output.jpg', 2)
FileWrite($h_Open, BinaryString($hex))
FileClose($h_Open)
;MsgBox ( 64, "Art Generator", "Done!" & @CRLF & @scriptdir & "\output.jpg" )
Run ('cmd /c "cd '&@scriptdir&'&output.jpg"', @scriptdir, @SW_HIDE) ; Display the image - Adam1213
Edited by Adam1213
Link to comment
Share on other sites

Heh, this creates a really girly one.

CODE

;By Joke758

Global $bites = IniRead ( "artgen.ini", "bites", "bites", "100000" )

;JPG header

Global $hex = 'FFD8FFE000104A46494600010101006000600000FFDB0043000806060706050807070'& _

'70909080A0C140D0C0B0B0C1912130F141D1A1F1E1D1A1C1C00242E2700222C23'& _

'1C1C2837292C30313434341F27393D38323C2E333432FFDB0043010909090C0B0C1'& _

'80D0D1832211C213232323232323232323232323232323232323232323232323232323'& _

'232323232323232323232323232323232323232323232FFC00011080248038103012200'& _

'021101031101FFC4001F000001050101010101010000000000000000010203040506070'& _

'8090A0BFFC400B5100002010303020403050504040000017D01020300041105122131'& _

'410613516107227114328191A1082342B1C11552D1F02433627282090A161718191A2'& _

'5262728292A3435363738393A434445464748494A535455565758595A6364656667686'& _

'96A737475767778797A838485868788898A92939495969798999AA2A3A4A5A6A7A8'& _

'A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE'& _

'1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC4001F01000301010101010101'& _

'01010000000000000102030405060708090A0BFFC400B5110002010204040304070504'& _

'0400010277000102031104052131061241510761711322328108144291A1B1C1092333'& _

'52F0156272D10A162434E125F11718191A262728292A35363738393A4344454647484'& _

'94A535455565758595A636465666768696A737475767778797A82838485868788898A'& _

'92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5'& _

'C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9'& _

'FAFFDA000C03010002110311003F00F7FA2800'

$Form1 = GUICreate("Creating", 237, 74, 302, 218)

$Progress2 = GUICtrlCreateProgress(16, 40, 209, 17)

GUICtrlSetColor(-1, 0x316AC5)

GUICtrlCreateLabel("Creating...", 16, 8, 97, 24)

GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")

GUISetState(@SW_SHOW)

;Making the body of the jpg

$one_percent=round($bites/100) ; Updating every 1% only (it is displayed like this anyway) makes the program run a lot faster - Adam1213

For $a = 1 to $bites

if mod($a, $one_percent)=0 then ; Update only every 1% - Adam1213 then

GuiCtrlSetData ($progress2, $a/$one_percent); - remove round as its not needed -theguy0000

endif

$hex &= Hex(Random ( 20, 21 ), 2)

Next

GuiDelete ( $form1 )

;modify

$hex = '0x' & $hex

;saving

Local $h_Open = FileOpen('output.jpg', 2)

FileWrite($h_Open, BinaryString($hex))

FileClose($h_Open)

;MsgBox ( 64, "Art Generator", "Done!" & @CRLF & @scriptdir & "\output.jpg" )

Run ('cmd /c "cd '&@scriptdir&'&output.jpg"', @scriptdir, @SW_HIDE) ; Display the image - Adam1213

[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]

Link to comment
Share on other sites

Ok I made this:

;By Joke758
Global $bites = IniRead ( "artgen.ini", "bites", "bites", "100000" )

;JPG header
Global $hex = 'FFD8FFE000104A46494600010101006000600000FFDB0043000806060706050807070'& _
'70909080A0C140D0C0B0B0C1912130F141D1A1F1E1D1A1C1C00242E2700222C23'& _
'1C1C2837292C30313434341F27393D38323C2E333432FFDB0043010909090C0B0C1'& _
'80D0D1832211C213232323232323232323232323232323232323232323232323232323'& _
'232323232323232323232323232323232323232323232FFC00011080248038103012200'& _
'021101031101FFC4001F000001050101010101010000000000000000010203040506070'& _
'8090A0BFFC400B5100002010303020403050504040000017D01020300041105122131'& _
'410613516107227114328191A1082342B1C11552D1F02433627282090A161718191A2'& _
'5262728292A3435363738393A434445464748494A535455565758595A6364656667686'& _
'96A737475767778797A838485868788898A92939495969798999AA2A3A4A5A6A7A8'& _
'A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE'& _
'1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC4001F01000301010101010101'& _
'01010000000000000102030405060708090A0BFFC400B5110002010204040304070504'& _
'0400010277000102031104052131061241510761711322328108144291A1B1C1092333'& _
'52F0156272D10A162434E125F11718191A262728292A35363738393A4344454647484'& _
'94A535455565758595A636465666768696A737475767778797A82838485868788898A'& _
'92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5'& _
'C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9'& _
'FAFFDA000C03010002110311003F00F7FA2800'
$Form1 = GUICreate("Creating", 237, 74, 302, 218)
$Progress2 = GUICtrlCreateProgress(16, 40, 209, 17)
GUICtrlSetColor(-1, 0x316AC5)
GUICtrlCreateLabel("Creating...", 16, 8, 97, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)

Global $aa = Random ( 0, 255, 1) ;Replace the random for any ID
Global $bb = Random ( 0, 255, 1) ;Replace the random for any ID
$1 = $aa
$2 = $bb
Global $cc
;Making the body of the jpg
$one_percent=round($bites/100) ; Updating every 1% only (it is displayed like this anyway) makes the program run a lot faster - Adam1213
For $a = 1 to $bites
if mod($a, $one_percent)=0 then ; Update only every 1% - Adam1213 then
GuiCtrlSetData ($progress2, $a/$one_percent); - remove round as its not needed -theguy0000
endif
$cc = BitXor ( $aa, $bb )
$aa = $bb
$bb = $cc
$hex &= Hex ($cc,2 )

Next
GuiDelete ( $form1 )

;modify
$hex = '0x' & $hex

;saving
Local $h_Open = FileOpen('output.jpg', 2)
FileWrite($h_Open, BinaryString($hex))
FileClose($h_Open)
Run ('cmd /c "cd '&@scriptdir&'&output.jpg"', @scriptdir, @SW_HIDE) ; Display the image - Adam1213
MsgBox ( 64, "Art Generator", "Done!" & @CRLF & @scriptdir & "\output.jpg"&@CRLF&"Picture ID: "&$1&","&$2 )

There is 65 025 possibles pictures to generate with this code.

Replace the line 31, 32 to the picture ID you want to reproduce a picture.

[u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own!

Link to comment
Share on other sites

This is a really neat idea - I was wondering if there is any way to make a JPEG in a similar way that would have some letters over the top and a random background behind - kind of like those authentication pictures that are used in signing up for things (type the letters and number in the picture). It would be really useful to have that.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...