Author Topic: Is anyone able to create a random pixel generator?  (Read 13264 times)

0 Members and 1 Guest are viewing this topic.

Offline JonLeung

  • Administrator
  • *****
  • Posts: 3630
Is anyone able to create a random pixel generator?
« on: February 13, 2009, 05:40:49 pm »
Let's say that for some...um...project I want to have a random assortment of tiles.



I'd like to take a random assortment of pixels, blow it up 16x, and then use Revned's Tile Slicer/Splicer to replace the blown-up random pixels into random tiles.



Of course that means I need to have a random assortment of pixels to begin with.



So since there are some smart coders here, I don't think it should be hard to ask for a program that:

1. Asks for how many different pixels I need.

2. Asks for the dimensions of the output image.

3. Generates an image of the specified size using however many different pixels were specified.



(It really shouldn't matter what colours are used for the pixels.  I believe in most cases I'd have like 3-10 different pixels/tiles in any given situation so it might help me visually to have them distinct rainbow colours, but as I plan to run it through the Tile Slicer/Splicer of Revned's it truly wouldn't matter if I couldn't even tell the different pixels apart with my own eyes.)



An advanced feature could be to guarantee that the same coloured pixel doesn't show up twice in a row but that's not necessary at this point.



It would be a tremendous help, more than you know.



Thanks in advance!  I hope I'm not presumptuous in thinking someone would want to do this...  :P

Offline DarkWolf

  • Hero Member
  • *****
  • Posts: 640
RE: Is anyone able to create a random pixel generator?
« Reply #1 on: February 13, 2009, 07:06:43 pm »
Wouldn't it just be easier to make something that randomly generates an random images from a tileset or am I missing the point?

Offline JonLeung

  • Administrator
  • *****
  • Posts: 3630
RE: Is anyone able to create a random pixel generator?
« Reply #2 on: February 13, 2009, 07:22:33 pm »
Well, either way.  :P



I thought it would be easier to start from pixels 'cause then the program writer wouldn't have to mess around with asking for a folder where the image files are kept and how to handle them if they weren't the same size, etc.

Offline Revned

  • Hero Member
  • *****
  • Posts: 1094
RE: Is anyone able to create a random pixel generator?
« Reply #3 on: February 13, 2009, 07:23:53 pm »
The format Tile Splicer reads is pretty simple. I bet you could whip up something in Excel or similar to make a random distribution of tiles.

Offline Maxim

  • Hero Member
  • *****
  • Posts: 974
RE: Is anyone able to create a random pixel generator?
« Reply #4 on: February 16, 2009, 06:59:11 am »
Generate noise, decrease colour depth... done?

Offline JonLeung

  • Administrator
  • *****
  • Posts: 3630
RE: Is anyone able to create a random pixel generator?
« Reply #5 on: February 16, 2009, 06:04:56 pm »
That sounds like it might actually work...  >_>

Offline JonLeung

  • Administrator
  • *****
  • Posts: 3630
RE: Is anyone able to create a random pixel generator?
« Reply #6 on: February 16, 2009, 06:46:10 pm »
Okay, it has...but now I have an image file 6400 x 2880 (enlarged from 400 x 180) and while I can slice it, I can't splice it back together using Revned's Tile Slicer/Splicer.



Is the image file too big, or what am I doing wrong?



EDIT: Never mind, I just made a smaller one.  I didn't need it as big as the whole image that I would be pasting on top of it anyway.  Only as big as the transparent parts.  :P

Offline Revned

  • Hero Member
  • *****
  • Posts: 1094
RE: Is anyone able to create a random pixel generator?
« Reply #7 on: February 16, 2009, 07:48:56 pm »
Yeah, Java probably ran out of memory. You can manually increase its allocation, but doing it in pieces is probably easier.

Offline Maxim

  • Hero Member
  • *****
  • Posts: 974
RE: Is anyone able to create a random pixel generator?
« Reply #8 on: February 17, 2009, 03:25:30 am »
Add "-Xmx1G" onto the Java commandline when it gets OutOfMemoryExceptions to let it use up to 1GB.