| probelm with jpg export from exportdialog? [message #1947] |
Thu, 16 August 2007 19:31  |
skyebend Messages: 7 Registered: March 2004 |
Member |
|
|
Hi folks,
I was just updating SoNIA in order to use version vector graphics 2.1.1. Testing output formats. SVG and SWF and GIF working great! (had some bugs for me before) But when I export to jpg I get a really wierd red color over the whole image. (see attached png and jpg) Does not happen to PNG or GIF Any thoughts?
thanks,
-skye
Attachment: export.jpg
(Size: 11.84KB, Downloaded 297 time(s))
Attachment: export.png
(Size: 12.92KB, Downloaded 302 time(s))
|
|
|
|
| Re: probelm with jpg export from exportdialog? [message #1969 is a reply to message #1948 ] |
Thu, 23 August 2007 10:48   |
skyebend Messages: 7 Registered: March 2004 |
Member |
|
|
windoze
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode, sharing)
mac
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-164)
Java HotSpot(TM) Client VM (build 1.5.0_07-87, mixed mode, sharing)
on the mac version jpg appears black instead of red, bud pdf (attached)
yeah, not surprised the jpg isn't reading right, something odd with it. Could it have something to do with double buffering? Maybe it is not necessary to turn off anymore? But then the PNG should be messed up also.
Code below, commented version was for 1.x version of vector graphics.
JComponent compToPrint = getGraphicContent();
disableDoubleBuffering(compToPrint);
compToPrint.repaint();
// HEPDialog exportDialog = new HEPDialog("SoNIA");
// exportDialog.showHEPDialog(this, "Chose file format for export",
// compToPrint, "NetworkPic");
//THIS IS TO USE VERSION freehep 2.1.1
ExportDialog exportDialog = new ExportDialog();
exportDialog.showExportDialog(compToPrint,
"Chose file format for export...", compToPrint, "export");
enableDoubleBuffering(compToPrint);
best,
-skye
Attachment: jpgTest.jpg
(Size: 11.47KB, Downloaded 260 time(s))
|
|
|
| Re: probelm with jpg export from exportdialog? [message #2186 is a reply to message #1969 ] |
Wed, 19 December 2007 19:11   |
skyebend Messages: 7 Registered: March 2004 |
Member |
|
|
Hey just wanted to check in again about this bug. It is preventing me from upgrading to version 2.1 - need to have jpeg export working.
I just re-ran and produced the problem using the ExportDialogExample
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
I'm attaching here a screen shot of the jpg in GIMP, because the actual jpg is corrupted and won't display correctly:
best,
-skye
|
|
|
| Re: probelm with jpg export from exportdialog? [message #2650 is a reply to message #2186 ] |
Thu, 13 August 2009 10:55  |
skyebend Messages: 7 Registered: March 2004 |
Member |
|
|
Ok, after a year or so I'm finally digging around a bit to try to solve this. I notice that if I export an image using javax.imageio and look at it in graphic converter, It comes up with type RGB, but if I export with the VectorGraphics Export Dialog I get type CMYK. I'm wondering if it is possible that some of the flags are not getting set correctly when creating the BufferedImage?
I start digging randomly in the code of org.freehep.graphicsio.ImageGraphics2D.java I see a number of places where it is making checks for both JPG and JPEG formats:
private final static String alwaysCompressedFormats[] = {
ImageConstants.JPG.toLowerCase(),
ImageConstants.JPEG.toLowerCase(),
...
but it looks like the createBufferedImage method only check for the JPG format:
// NOTE: special case for JPEG which has no Alpha
if (ImageConstants.JPG.equalsIgnoreCase(format)) {
return new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
}
so it looks like if it was created with JPEG it would result to the default case of BufferedImage.TYPE_INT_ARGB
I checked this by switching from BufferedImage.TYPE_INT_RGB to BufferedImage.TYPE_INT_ARGB in my javix.imageio test case, and was able to produce an image consistent with the bad image that shows up as CMYK.
I'd rather not have to recompile all of freehep to check this bug, can anybody else take a look? Or suggest a workaround? Is it possible that the menu selection on the export dialog is returning JPEG not JPG format?
best,
-skye
|
|
|