PathwayCommons / chibe

Pathway visualization and analysis tool for Pathway Commons and other BioPAX data
Eclipse Public License 1.0
13 stars 10 forks source link

Cannot save images as .gif #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If you try to save pathway or image as a gif file, you get the following 
exception and an empty gif file is generated:

org.eclipse.swt.SWTException: Unsupported color depth
    at org.eclipse.swt.SWT.error(Unknown Source)
    at org.eclipse.swt.SWT.error(Unknown Source)
    at org.eclipse.swt.SWT.error(Unknown Source)
    at org.eclipse.swt.internal.image.GIFFileFormat.unloadIntoByteStream(Unknown Source)
    at org.eclipse.swt.internal.image.FileFormat.unloadIntoStream(Unknown Source)
    at org.eclipse.swt.internal.image.FileFormat.save(Unknown Source)
    at org.eclipse.swt.graphics.ImageLoader.save(Unknown Source)
    at org.eclipse.swt.graphics.ImageLoader.save(Unknown Source)
    at org.gvt.action.SaveAsImageAction.run(SaveAsImageAction.java:139)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:996)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
    at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:809)
    at org.eclipse.jface.window.Window.open(Window.java:787)
    at org.gvt.ChisioMain.main(ChisioMain.java:207)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)

I did a quick search about this exception and found this information: "Saving 
an ImageData as a GIF is expected to work if your image data is of bit depth 1, 
4 or 8." So it seems these images does not satisfy this depth requirement. 
Should we try to find an alternative way of saving as gif files or omit gif 
file option? What is your suggestion?

Original issue reported on code.google.com by mervecak...@gmail.com on 27 Sep 2012 at 1:45

GoogleCodeExporter commented 9 years ago
That's strange. That's a Chisio feature, shouldn't get affected by ChiBE 
improvements. Are we doing any fancy kind of rendering now (due to SBGN) that 
might be causing this exception? Can you please try saving simpler views?

Original comment by ugurdogr...@gmail.com on 27 Sep 2012 at 7:11

GoogleCodeExporter commented 9 years ago
Are you sure it works in ChiEd? I cannot try because there is no Linux 64 bit 
version in the downloads page. If it works in ChiEd, then we can transfer the 
code to ChiBE.

Original comment by ozgunba...@gmail.com on 27 Sep 2012 at 7:19

GoogleCodeExporter commented 9 years ago
Ozgun, it was definitely working in version 1.0 of Chisio. I think ChiBE is 
still based on that version of Chisio, right? You only upgraded the layout 
package to version 2.0, not the editor portion.

Original comment by ugurdogr...@gmail.com on 27 Sep 2012 at 7:22

GoogleCodeExporter commented 9 years ago
Yes I only upgraded layout part. However, there may be changes in image saving 
code too. I don't remember when and why.

Let's compare current code with Chisio 1.1. 

Original comment by ozgunba...@gmail.com on 27 Sep 2012 at 7:42

GoogleCodeExporter commented 9 years ago
If ChiBE is based on Chisio 1.1, I would first check to see if this feature 
properly works in Chisio 1.1. Insatallers for this older version should be 
somewhere under ~ivis. If all is fine there, comparing code would be tje right 
way to proceed.

Original comment by ugurdogr...@gmail.com on 27 Sep 2012 at 7:52

GoogleCodeExporter commented 9 years ago
I have downloaded installers from the web pages for both ChiEd 2.0 and ChiBE 
1.1. In these versions, there are only jpeg and bmp options, I could not see 
gif. 
I have also checked the current ChiBE code and found a comment about addition 
of png and gif support. It seems gif support is added after ChiBE 1.1. 

Original comment by mervecak...@gmail.com on 28 Sep 2012 at 8:57

GoogleCodeExporter commented 9 years ago
OK, now it makes sense. In that case I suggest we skip gif. We already have png.

Original comment by ozgunba...@gmail.com on 28 Sep 2012 at 12:55

GoogleCodeExporter commented 9 years ago
Interesting, I wonder why we added gif support when we had both jpg and png 
support.
Yes, I agree we should delete gif support.

Original comment by ugurdogr...@gmail.com on 1 Oct 2012 at 8:43

GoogleCodeExporter commented 9 years ago
OK then, I have removed gif support. 

Original comment by mervecak...@gmail.com on 2 Oct 2012 at 2:30

GoogleCodeExporter commented 9 years ago

Original comment by ugurdogr...@gmail.com on 15 Oct 2012 at 8:52