We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › New Programmer,replace each pixel with small image
Page Index Toggle Pages: 1
New Programmer,replace each pixel with small image (Read 517 times)
New Programmer,replace each pixel with small image
Apr 12th, 2009, 3:08pm
 
Hey,

I've never used processing before but I know a little Java. For a project I'm interested in taking a small lo-res image, and basically saying "for each pixel, replace with a different image based on that pixel's color."

Would this be too complicated in processing? Maybe someone could point me in the right direction? Thanks Cheesy!
Re: New Programmer,replace each pixel with small image
Reply #1 - Apr 12th, 2009, 3:20pm
 
just had another thought -

it might help if I'm more specific about my idea - I want to replace each pixel with an image of a piece of colored construction paper. so i get little construction-paper pixels. I think it might give the image some interesting texture.

an acceptable solution would also be to say "multiply each pixel by, say, 10x10 pixels." So for example, a red pixel would then be a 10x10 pixel block. I could then go into photoshop, reduce the image transparency, and place a grid of monochrome construction paper sheets behind it.

does that make any sense?
Re: New Programmer,replace each pixel with small image
Reply #2 - Apr 12th, 2009, 3:29pm
 
I have no idea how complicated, I'm new to processing aswell but maybe I can help a bit.

You must have a bunch a images that can be used to fill, for those images you must calculate the average color.

you should add every value for RGB (sorry for my bad english).
Like every pixel has a RED, GREEN and BLUE value.
let's take 4 pixels for a example:
1= R 100, G 150, B 80
2= R 46,   G 32,  B 50
3= R 233, G 28,  B 28
4= R 120, G 230, B 90

now multiply:
red: 100+46+233+120 = 499
green: 150+32+28+230 = 440
blue: 80+50+28+90 = 248

now devide that by the ammount of pixels
red: 499/4 = 125
green: 440/4 = 110
blue: 248/4 = 62

so 125, 110, 62 is the average value of that image(4 pixels..)
Re: New Programmer,replace each pixel with small image
Reply #3 - Apr 13th, 2009, 3:37am
 
You might find ideas from my Image to text sketch. I use letters, you can use images instead.
Re: New Programmer,replace each pixel with small image
Reply #4 - Apr 13th, 2009, 5:43am
 
From what I've read, using a single pixel point and applying a texture to that point is referred to as using "point sprites".  There is a very basic example in Processing of a bear image (Examples, Basics, Image, Sprite).  More advanced point sprite examples can be found on the forum.
Page Index Toggle Pages: 1