bugKawa - Bugs: bug #49367, (kawa pictures) image-write gives...

 
 

bug #49367: (kawa pictures) image-write gives exception on pictures

Submitter:  Sudarshan S Chawathe <chaw>
Submitted:  Sun 16 Oct 2016 08:23:41 PM UTC
   
 
Category:  Scheme library Severity:  3 - Normal
Item Group:  Run-time exception Status:  Fixed
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 23 Oct 2016 09:39:59 PM UTC, comment #2: 

This change seems to have fixed the problem. Thanks!

[Tested with the SVN version of around 5:00 pm EDT today.]


Sudarshan S Chawathe <chaw>
Sun 23 Oct 2016 02:43:53 PM UTC, comment #1: 

Strange.  It works for me with Java SE 1.8.0_74-b02 on Fedora.  Possibly a (fixed) bug in ImageIO.

Regardless, writing something that isn't a BufferedImage is less efficient (based on glancing at the OpenJDK source).  Since a DrawImage wraps a BufferedImage, might as well pass that instead to ImageIO.write.  I checked in a change to do that.  Please let me now if that solves the problem.

Per Bothner <bothner>
Group administrator
Sun 16 Oct 2016 08:23:41 PM UTC, original submission:  


image-write produces a run-time exception (below) when used on a picture (even with an explicit ->image conversion).  A simple example that triggers the error is below.  This is with the SVN Kawa version (from yesterday) on 32-bit Debian Jessie and OpenJDK 8.

(import (kawa pictures))

(image-write (circle 30) "/tmp/t.jpg") ; error
(image-write (->image (circle 30)) "/tmp/t.jpg") ; same error

(define img1 (image-read "http://pics.bothner.com/2013/Cats/06t.jpg"))
(image-write img1 "/tmp/t.jpg") ; works


Error...

javax.imageio.IIOException: Invalid argument to native writeImage
at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native Method)
at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeOnThread(JPEGImageWriter.java:1067)
at com.sun.imageio.plugins.jpeg.JPEGImageWriter.write(JPEGImageWriter.java:363)
at javax.imageio.ImageWriter.write(ImageWriter.java:615)
at javax.imageio.ImageIO.doWrite(ImageIO.java:1612)
at javax.imageio.ImageIO.write(ImageIO.java:1578)
at kawa.lib.kawa.pictures.imageWrite(pictures.scm:150)
at b201.run(b201.scm:3)
at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:293)
at gnu.expr.CompiledModule.evalModule(CompiledModule.java:42)
at gnu.expr.CompiledModule.evalModule(CompiledModule.java:60)
at kawa.Shell.runFile(Shell.java:565)
at kawa.Shell.runFileOrClass(Shell.java:468)
at kawa.repl.processArgs(repl.java:689)
at kawa.repl.main(repl.java:811)

Sudarshan S Chawathe <chaw>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bothner (Posted a comment)
  • -email is unavailable- added by chaw (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-10-23 bothner Open/ClosedOpen Closed
    2016-10-23 bothner StatusNone Fixed
        Assigned toNone bothner

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code