Solved

Java Image.

Posted on 2001-08-01
7
231 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 50 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iterator/ListIterator approach 17 68
jsp insert to database example 2 90
maven disable workspace resolution 1 77
Html split(text) 2 49
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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 learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

738 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