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 & HelpOther Libraries › Sending PImage using processing.net library
Page Index Toggle Pages: 1
Sending PImage using processing.net library (Read 725 times)
Sending PImage using processing.net library
Oct 4th, 2009, 9:52pm
 
Hey there, just looking for some help in sending images using the processing.net library.

I'm guessing I need to convert it to bytes, but couldn't find an easy method of conversion.

I'm using a simple single server single client application based mainly off the .net examples.

Does anyone have something out there?
Re: Sending PImage using processing.net library
Reply #1 - Oct 4th, 2009, 11:14pm
 
You need to send them where
To a server, there is a library for this.
Between two instances of a sketch, you can just convert the pixels[] array to byte[], or use getImage() to have a BufferedImage (in the form of a java.awt.Image).

Edit: to convert int[] to byte[], you have various methods, from looping on the array and splitting int to bytes with bit shifting and masking (eg. Convert an int to a byte array with an answer from toxi...), or just using the awesome Java library: Java: How to convert int[] to byte[] (Jon Skeet's answer).
Page Index Toggle Pages: 1