gif-animation icon indicating copy to clipboard operation
gif-animation copied to clipboard

Processing 3 branch fails to export gifs "Width (0) and height (0) cannot be <=0"

Open macrael opened this issue 8 years ago • 5 comments

The 3.0 branch of processing does not work. I'm running processing 3.0.2 and even the included example gifExport fails in this way.

Exception in thread "Thread-2" java.lang.IllegalArgumentException: Width (0) and height (0) cannot be <= 0 at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1016) at java.awt.image.BufferedImage.(BufferedImage.java:333) at gifAnimation.GifMaker.addFrame(GifMaker.java:153) at gifAnimation.GifMaker.addFrame(GifMaker.java:145) at gifExport.draw(gifExport.java:54) at processing.core.PApplet.handleDraw(PApplet.java:2402) at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:859) at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692) at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674) at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443) at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293) at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147) at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:759) at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81) at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452) at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178) at java.util.TimerThread.mainLoop(Timer.java:555) at java.util.TimerThread.run(Timer.java:505)

macrael avatar Apr 14 '16 04:04 macrael

I got same error when using P3D mode. In that case, I solved the issue by this.loadPixels(); gifExport.addFrame(this.pixels, width, height); instead of gifExport.addFrame(); (where this implies any PApplet).

ghost avatar May 18 '17 07:05 ghost

@jeremydouglass and @macrael can you confirm this is resolved in the new 3.0 default branch? The library will be served at

  • https://github.com/extrapixel/gif-animation/raw/3.0/distribution/gifAnimation.txt
  • https://github.com/extrapixel/gif-animation/raw/3.0/distribution/gifAnimation.zip

extrapixel avatar Oct 06 '21 00:10 extrapixel

@extrapixel I've installed the 3.0 library from the zip link above and tested both example gifDisplay and gifExport on Processing 3.4 and 3.5.4 -- both examples ran and displayed / saved correctly in both Processing versions.

I don't have Processing 4 on this machine -- maybe somebody else could give that a quick check?

jeremydouglass avatar Oct 06 '21 03:10 jeremydouglass

Quick notes:

  1. gifAnimation.txt lists minrevision = 0246 -- that's Processing 3.0. That seems reasonable, I'll just note that I didn't actually test on 3.0, only 3.4 and 3.5.4.

  2. I believe that the old 2.0 library directory was GifAnimation and the new one is gifAnimation. Not necessarily an issue, just noting the change.

  3. These "raw" urls may be submitted directly to the Processing librarian for listing in Contributions manager. However, if they are uploaded as attachments to a github 3.0 release on this repo, then the urls will be:

https://github.com/extrapixel/gif-animation/releases/latest/download/gifAnimation.txt https://github.com/extrapixel/gif-animation/releases/latest/download/gifAnimation.zip

...which is useful, because if is later a 3.1 release or 3.2 release et cetera, that new release and its attachments will automatically become the new "latest" urls on github, and then those urls don't need to be resubmitted to contributions manager and go through a potentially multi-day update and sync process.

jeremydouglass avatar Oct 06 '21 03:10 jeremydouglass

thanks @jeremydouglass !

I think this issue can be closed.

Regarding your other notes - they all are valid points.

  1. I agree, we should at least test the advertised minrevision or change it to something that we did test.
  2. Yes I think it was renamed in the PR #21 but I'm not sure why. I assumed some new naming convention?
  3. For the time being, i have submitted the raw urls to the librarian. My goal is to finally get this back into the library manager in the hopes to get more activity to this repo. In the medium term i think the release / distribution process needs to be refined.

extrapixel avatar Oct 06 '21 12:10 extrapixel