Save matrix as image

29 views
Skip to first unread message

salvador

unread,
Mar 30, 2013, 7:52:20 AM3/30/13
to efficient-java-mat...@googlegroups.com
How can i save the output from the MatrixVisualization.show() as an image (any format)
Message has been deleted

Peter A

unread,
Mar 30, 2013, 5:11:56 PM3/30/13
to efficient-java-mat...@googlegroups.com
here you go:

    public static void main( String args[] ) throws IOException {
        DenseMatrix64F m = RandomMatrices.createRandom(5,5,new Random());

        int w = 200, h = 200;

        MatrixComponent panel = new MatrixComponent(w,h);
        panel.setMatrix(m);

        BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
        Graphics2D g = bi.createGraphics();
        panel.paint(g);

        ImageIO.write(bi, "png", new File("matrix.png"));
    }




On Sat, Mar 30, 2013 at 8:03 AM, salvador <sot....@gmail.com> wrote:


Τη Σάββατο, 30 Μαρτίου 2013 1:52:20 μ.μ. UTC+2, ο χρήστης salvador έγραψε:
How can i save the output from the MatrixVisualization.show() as an image (any format)

--
You received this message because you are subscribed to the Google Groups "efficient-java-matrix-library-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to efficient-java-matrix-li...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
"Now, now my good man, this is no time for making enemies."    — Voltaire (1694-1778), on his deathbed in response to a priest asking that he renounce Satan.

salvador

unread,
Mar 31, 2013, 12:03:57 PM3/31/13
to efficient-java-mat...@googlegroups.com
nice, thanks!
Reply all
Reply to author
Forward
0 new messages