473,387 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Generating images from data

Salve.

I'm somewhat new to Java, but I learn quickly. However, one thing that
I'm trying to do is stumping me badly.

I[0] have a network application, originally written in C, that transmits
images in a fairly simple but nonstandard format over a socket connection.
I've gotten as far as recieving and decompressing[1] the image data, but
I'm somewhat stumped as to how to get it onto the screen. The Swing and
AWT documentation in the API docs haven't helped too much; they do a great
job of listing methods and a poor job of outlining how those methods
interact with each other.

Options that have sprung out at me:

- implement ImageProducer. It looks like I can get ColorModel to do a
certain amount of the heavy lifting as far as converting the decompressed
image data into pixels goes, and there seems to be a way to get a Raster,
and thence an Image, out of it that way. Only problem is, I don't see how.

- Create a method that accepts a Graphics object and unRLEs the image data
into lines on the image. I *think* this might result in having to redo
the RLE decompression if the image is ever redrawn, which, if true, would
be non-optimal.

Any thoughts?

Owen
[0] My employer, actually.
[1] Simple RLE algorithm on each raster line.

--
Some say the Wired doesn't have political borders like the real world,
but there are far too many nonsense-spouting anarchists or idiots who
think that pranks are a revolution.

Jul 17 '05 #1
3 1910
Owen,

Probably the simplest way to do this would be to use a BufferedImage.
That way, you can just set the pixels yourself. Implementing an
ImageProducer might be more elegant, but would take a little more work.

--Nathan Davis

Owen Jacobson wrote:
Salve.

I'm somewhat new to Java, but I learn quickly. However, one thing that
I'm trying to do is stumping me badly.

I[0] have a network application, originally written in C, that transmits
images in a fairly simple but nonstandard format over a socket connection.
I've gotten as far as recieving and decompressing[1] the image data, but
I'm somewhat stumped as to how to get it onto the screen. The Swing and
AWT documentation in the API docs haven't helped too much; they do a great
job of listing methods and a poor job of outlining how those methods
interact with each other.

Options that have sprung out at me:

- implement ImageProducer. It looks like I can get ColorModel to do a
certain amount of the heavy lifting as far as converting the decompressed
image data into pixels goes, and there seems to be a way to get a Raster,
and thence an Image, out of it that way. Only problem is, I don't see how.

- Create a method that accepts a Graphics object and unRLEs the image data
into lines on the image. I *think* this might result in having to redo
the RLE decompression if the image is ever redrawn, which, if true, would
be non-optimal.

Any thoughts?

Owen
[0] My employer, actually.
[1] Simple RLE algorithm on each raster line.


Jul 17 '05 #2
i was under the impression that rle was a standard bitmap implementation
that should be ideal for the Java2D api to utilize. if not, then you'll
have to invest sometime investigating how Java2D works. a trip down to
your local book store is strongly advised. there are examples similiar
to what you are doing out there and java will be able to handle it for you.

- perry

Owen Jacobson wrote:
Salve.

I'm somewhat new to Java, but I learn quickly. However, one thing that
I'm trying to do is stumping me badly.

I[0] have a network application, originally written in C, that transmits
images in a fairly simple but nonstandard format over a socket connection.
I've gotten as far as recieving and decompressing[1] the image data, but
I'm somewhat stumped as to how to get it onto the screen. The Swing and
AWT documentation in the API docs haven't helped too much; they do a great
job of listing methods and a poor job of outlining how those methods
interact with each other.

Options that have sprung out at me:

- implement ImageProducer. It looks like I can get ColorModel to do a
certain amount of the heavy lifting as far as converting the decompressed
image data into pixels goes, and there seems to be a way to get a Raster,
and thence an Image, out of it that way. Only problem is, I don't see how.

- Create a method that accepts a Graphics object and unRLEs the image data
into lines on the image. I *think* this might result in having to redo
the RLE decompression if the image is ever redrawn, which, if true, would
be non-optimal.

Any thoughts?

Owen
[0] My employer, actually.
[1] Simple RLE algorithm on each raster line.


Jul 17 '05 #3
another approach would be to utilize the C code you already have that
receives and decompresses. under java you would access your C code using
JNI. there, you write a function that passes a decompressed bitmap back
to whatever needs it.

this can be and should be done in an elegant manner otherwise you'll end
up with code that you won't want to use. check out "Essential JNI"

- perry

Owen Jacobson wrote:
Salve.

I'm somewhat new to Java, but I learn quickly. However, one thing that
I'm trying to do is stumping me badly.

I[0] have a network application, originally written in C, that transmits
images in a fairly simple but nonstandard format over a socket connection.
I've gotten as far as recieving and decompressing[1] the image data, but
I'm somewhat stumped as to how to get it onto the screen. The Swing and
AWT documentation in the API docs haven't helped too much; they do a great
job of listing methods and a poor job of outlining how those methods
interact with each other.

Options that have sprung out at me:

- implement ImageProducer. It looks like I can get ColorModel to do a
certain amount of the heavy lifting as far as converting the decompressed
image data into pixels goes, and there seems to be a way to get a Raster,
and thence an Image, out of it that way. Only problem is, I don't see how.

- Create a method that accepts a Graphics object and unRLEs the image data
into lines on the image. I *think* this might result in having to redo
the RLE decompression if the image is ever redrawn, which, if true, would
be non-optimal.

Any thoughts?

Owen
[0] My employer, actually.
[1] Simple RLE algorithm on each raster line.


Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: duncan.lovett | last post by:
I want to generate dynamic heading images, but I won't be able to use the GD Library, ImageMagick or any other plug-in to generate an image on the fly due to hosting restrictions. I have seen,...
8
by: Fabricio Sperandio | last post by:
Hi everyone, I am trying to generate some thumbnails using System.Drawing.Image Class. Actually the GetThumnailImage method. The question is: How can I get a better thumbnail picture? I mean,...
8
by: Lars Netzel | last post by:
Hey! I wrote a message yersterday and got some good answers and have now managed to generate a nice image. The problem is that it's all generated in an Images.Aspx file and I don't really want...
1
by: Xah Lee | last post by:
The following is a program to generate thumbnail images for a website. Useful, if you want to do that. It is used to generate the thumbnails for my “Banners, Damsels, and Mores” project...
2
by: bizt | last post by:
Hi, Is it possible to obtain the width/ height of an image when that image is dyanically created using a PHP script and passing GET attributes. For example: <img...
11
by: Faisal Vali | last post by:
Are there any guidelines people use that help them decide when it is better to dynamically generate all html elements using javascript versus actually writing some html and using it as scaffolding?...
1
by: rajesha | last post by:
i m new to perl cgi scripting i required to genearte some sort of image(s) after reading some data from the server through cgi script. That image contains different components which is decided...
0
by: Miki | last post by:
Hello, I'm trying to write something like http://blabberize.com/, generating a video file with lip-sync. Currently the general idea is: * Generate animation images using GIMP * Sample voice...
0
by: Irmen de Jong | last post by:
Hi, I wanted to generate Captcha images(*) from Python and I couldn't find any module that suited my needs so I made one myself. It only needs PIL. (I used PIL 1.1.6) It can generate images...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.