PNG-Encoder Performance

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Tzaphkiel
Posts: 44
Joined: Tue May 13, 2003 1:37 pm
Location: Belgium

Post by Tzaphkiel » Thu Feb 24, 2005 12:05 pm

Hi all, I've updated my previous post correcting a "big" bug under windows !

see the
Tzaphkiel wrote:Edit: png.pHYs_unitSpecifier = 1; must be specified otherwise windows does not recognize the dpi correctly in the file (it sees 96 dpi whilst IrfanView sees the 300dpi) !
Also int resX = (int)Math.ceil(resolution / 0.0254f); is "ceilled" because otherwise, windows sees 299 dpi...
section and the code above it has also changed a bit!

Now everything works well !

NB: the ImageWriteParam iwparam is not neccessary anymore !

Regards
Tzaphkiel
Image

mhilpert
Posts: 497
Joined: Wed Apr 02, 2003 1:57 pm
Location: Germany

Post by mhilpert » Tue Apr 12, 2005 10:40 am

david.gilbert wrote:Thanks for your post. We need to maintain compatibility with JDK 1.3 still as there are a good number of users that need it.
But after you released the final 1.0.0 version, you could jump to JDK 1.5 for your development branch of the 2.x version (leaving the 1.x version for JDK 1.3), as the 2.x version will also have API changes (as you wrote).
Java 11, JFreeChart 1.0.15, JFreeSVG 4.0

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Tue Apr 12, 2005 12:04 pm

mhilpert wrote:But after you released the final 1.0.0 version, you could jump to JDK 1.5 for your development branch of the 2.x version (leaving the 1.x version for JDK 1.3), as the 2.x version will also have API changes (as you wrote).
One of my goals after 1.0.0 is released is to ensure that JFreeChart runs well on free runtimes (GCJ, GNU Classpath etc.), so that free software that depends on JFreeChart (e.g. StatCVS) can be included in Linux distros that can't or won't distribute Sun's proprietary JDK. For that reason, I'm unlikely to jump to JDK 1.5 for development. It might be feasible to jump to 1.4 though, I'll look at that more closely after 1.0.0 is done.

Just so no-one is confused, the 1.0.x "stable" branch will target JDK 1.2.2 or later.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

mhilpert
Posts: 497
Joined: Wed Apr 02, 2003 1:57 pm
Location: Germany

Post by mhilpert » Thu Apr 14, 2005 10:08 am

david.gilbert wrote: One of my goals after 1.0.0 is released is to ensure that JFreeChart runs well on free runtimes (GCJ, GNU Classpath etc.), so that free software that depends on JFreeChart (e.g. StatCVS) can be included in Linux distros that can't or won't distribute Sun's proprietary JDK. For that reason, I'm unlikely to jump to JDK 1.5 for development. It might be feasible to jump to 1.4 though, I'll look at that more closely after 1.0.0 is done.

Just so no-one is confused, the 1.0.x "stable" branch will target JDK 1.2.2 or later.
Your understanding of "free" software is a little bit too restrictive. Sun's JDK is free - everyone can download it for free - it's also available for Linux in the latest version (it runs very well on my Linux machine). Even though it's not "OpenSource", that doesn't matter if you just want to use it, i.e. if you want develop Java 1.5 code. The other "free" Linux Java development kits are too old, they just support a subset of Sun's specification. Sun's JDK is not "proprietary" - any other "free" Java develeopment kit can follow the specificiation and code that runs on the Sun JRE will also run on any other ("free") JRE that implements the specification correctly. Of course, alternative Java development kits/runtime environment need to run the code as described in the specification (otherwise the whole idea of Java with it's platform independency wouldn't make sense). But the fact is, that other JDKs/JREs development is too slow and therefore several versions behind.

Sun doesn't charge anyone to use there Java runtime environment or the Java development kit. IBM doesn't charge for it's superb Java IDE Eclipse. EVerything is free to download and use. So there is no reason why you should stick with Java 1.2.2 which is already 7 years old ...
Java 11, JFreeChart 1.0.15, JFreeSVG 4.0

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Thu Apr 14, 2005 8:40 pm

mhilpert wrote:Your understanding of "free" software is a little bit too restrictive. Sun's JDK is free - everyone can download it for free
"Free Software is a matter of liberty not price." (The Free Software Foundation)
mhilpert wrote:So there is no reason why you should stick with Java 1.2.2 which is already 7 years old...
I can't think of a compelling reason to use a newer version of the API. The ImageIO stuff in 1.4 would be nice to use, but it's not essential. And the new stuff in 1.5 hasn't really grabbed my attention...even if it had, I won't be *requiring* it for JFreeChart until the vast majority of users have fully migrated their own code to 1.5. And that isn't going to be any time soon...
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

xnpeng
Posts: 1
Joined: Mon Apr 18, 2005 5:01 pm
Location: Shanghai,China
Contact:

exception raised

Post by xnpeng » Mon Apr 18, 2005 5:27 pm

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 1
at org.jfree.chart.block.FlowArrangement.arrangeNN(FlowArrangement.java:363)
at org.jfree.chart.block.FlowArrangement.arrangeRR(FlowArrangement.java:281)
at org.jfree.chart.block.FlowArrangement.arrange(FlowArrangement.java:156)
at org.jfree.chart.block.BlockContainer.arrange(BlockContainer.java:174)
at org.jfree.chart.title.LegendTitle.arrange(LegendTitle.java:329)
at org.jfree.chart.JFreeChart.drawTitle(JFreeChart.java:1073)
at org.jfree.chart.JFreeChart.draw(JFreeChart.java:959)
at org.jfree.chart.ChartPanel.paintComponent(ChartPanel.java:1132)
at javax.swing.JComponent.paint(JComponent.java:1003)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4930)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4883)
at javax.swing.JComponent._paintImmediately(JComponent.java:4826)
at javax.swing.JComponent.paintImmediately(JComponent.java:4633)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:451)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:114)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

JDK1.5 update2
JFreeChart 1.0.0-pre2
Ahaa

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Mon Apr 18, 2005 5:30 pm

Please post a small demo application that I can use to reproduce this error.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Tzaphkiel
Posts: 44
Joined: Tue May 13, 2003 1:37 pm
Location: Belgium

Post by Tzaphkiel » Wed Apr 20, 2005 8:05 am

Isn't this thread going haywire ? I beleive Phorum users will get lost if the topics' subject are not maintained... :?

I would suggest openning a new topic concerning JDK support or something of the like if you please ? :?:

Btw, the above mentionned code is currently working with a JDK 1.4 . :D

Regards
Tzaphkiel
Image

DavidThi808
Posts: 106
Joined: Fri May 27, 2005 7:44 pm
Location: Boulder, CO
Contact:

Post by DavidThi808 » Sat May 28, 2005 6:27 pm

Hello;

The attached code looks very useful but could someome please post what the following are (they are not declared in the code):
class: ChartParameter
local variables: _chart
global vars: CM_TO_INCH (2.54?)
_ScreenResolution (72 on Mac 96 or 104 on PC?)

thanks - dave

Tzaphkiel
Posts: 44
Joined: Tue May 13, 2003 1:37 pm
Location: Belgium

Post by Tzaphkiel » Mon May 30, 2005 3:17 pm

Hi,

ChartParameter is just a model object containing all the parameters that I'll apply to my chart such as margins, width, height, filename, output resolution, colors, DB serie id, etc.

_chart is the JFreeChart instance.

CM_TO_INCH is a public static double := 2.54D

_ScreenResolution is the user's machine screen resolution
there is a way to get it using:

Code: Select all

_screenResolution = Toolkit.getDefaultToolkit().getScreenResolution();
96dpi on windows XP :shock:
72 on mac os X


Cheers :D
Tzaphkiel
Image

erikvanoosten
Posts: 8
Joined: Tue Aug 30, 2005 10:42 am

What is the status?

Post by erikvanoosten » Tue Aug 30, 2005 10:48 am

Hi,

I am using Java 5 but I see the same performance problems for large PNG images. (JFreeChart is using ImageIO because ImageEncoderFactory.newInstance("png").toString() returns "org.jfree.chart.encoders.SunPNGEncoderAdapter@64dc11".)

After reading the thread I am not exactly sure what to do. Should I wait for the final 1.0 release and use the Keypoint PNG Encoder, or should I look for another (non free) PNG encoder?

Regards,
Erik.

Simon
Posts: 7
Joined: Mon Feb 16, 2004 11:06 am

Re: PNG-Encoder Performance

Post by Simon » Mon Feb 20, 2012 9:52 am

I had to move the pngs from the original Server, sorry for the inconvienience.
When I first posted the images I was not logged in, so I am not able to change the links in this post.

Image
Image
Image
Image

Locked