Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Java Image.

Posted on 2001-08-01
7
Medium Priority
?
239 Views
Last Modified: 2012-06-27
I am generating technical charts for stocks. Here i need to draw weekly, monthly and yearly graphs. I am taking different width and height for each of graph because of easy calculation and also i am restricted to take widht and height as integers.

Later, i am trying to make each of graph of in same size, using Image.getScaledInstance(widht,height,hints). But i am not getting proper visible results. If i take SCALE_SMOOTH as hints, its very slow in perforamance, also not satisyfing result.

Can any one guide me what to do, for getting clear, equal size, graphs?

0
Comment
Question by:vinaykn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 1

Accepted Solution

by:
lawrie earned 200 total points
ID: 6341431
Hello

It would sound to me that you have 3 choices

1) Draw all of the graphs the correct size initially, by making them resizable and accept the slightly more difficult calculations for drawing them (The best option in my opinion, because you could make them completely resizable in the process)

2) Accept the not so good native scaling in Java as you mention above.

3) Run it through some other image processing library to do the resize. This will use up more processing time though .. always a trade off between procedssing time and quality.

Hope this helps
0
 

Author Comment

by:vinaykn
ID: 6342949
Thanks for responding.

The second choice is not applicable in this case.

So first one, I am ready to for any kinda difficult calculation. But here i found, its not allowing me as its allowing only integers for height and widht. I need every decimal value for my graph. I found i am restricted to take height and widht in integers as it represents number of pixels..I will try to explain..

On x-axis i need to take 300 values, can i put 100 as widhth? How can i represent 3 values per one pixel???

If its the third choice, can you suggest me any oher image processing library?  I am new to this.

Keep writing..
0
 
LVL 3

Expert Comment

by:Sendoh
ID: 6343340
hi !!
think u can try out the AWT default strecth abilities by call graphics.drawImage() with x,y,width,height...

hope this helps...:)

regards
Sendoh
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Expert Comment

by:lawrie
ID: 6346128
Hello

I still think Option 1 is the best .. it would be better for you to decide how to display 3 values on one pixel, than trusting to an image compression algorithm, which would almost certainly create a blurry inaccurate image.

It takes a bit of though, but once working will be worth it. When I have been faced with this kind of data / size problem, I take a look at what I want to display. If the peaks are important, choose the biggest of the three overlapping points and show that, or you could go for the smallest of the 3, average, mean etc. It will depend on your data, but if you create a scaling algorithm that you like for your data, you should be able to reuse it, and that will make it easier to display

Something like:

public double[] convertData(double[] input, requiredPoints);

where the size of the result array will be what you specified, and the data is compressed / expanded based on what you decided above.

Hope this helps
0
 

Author Comment

by:vinaykn
ID: 6347148
Thanks lawrie

I need to represent each and every value. I think i need to take it should have its own pixel to represent so my picture width will be depending on its nuber of values.

yeah, when i compress its giving blurry inaccurate picture. So what to do get images of same size everytime?

I have gone through finance.yahoo.com.  There he is getting images of same size all the time.  I dont know what kinda image processing he is doing??

Can you suggest anything more?

0
 

Author Comment

by:vinaykn
ID: 6362816
Suggest me if anything comes new to you regarding this image processing...

Thank you very much...
0
 
LVL 1

Expert Comment

by:lawrie
ID: 6373581
perhaps check out the Java2D imaging techniques on the following page:
http://java.sun.com/products/java-media/2D/samples/suite/index.html

This includes more advanced scaling algorithms

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question