How to create a byte[] from a MemoryImageSource?

Discussion in 'Java' started by Greg Dameron, Jun 2, 2004.

  1. Greg Dameron

    Greg Dameron Guest

    I need to output a byte[] buffer from a class that has access to a
    MemoryImageSource and/or a BufferedImage. I need to be able to
    somehow convert that to a byte array to pass on to another class.
    Does anyone have an elegant way to convert from a bufferedimage (or
    MIS) to a byte array?
    Thanks!
    Greg
    Greg Dameron, Jun 2, 2004
    #1
    1. Advertising

  2. Greg Dameron

    ak Guest

    > I need to output a byte[] buffer from a class that has access to a
    > MemoryImageSource and/or a BufferedImage. I need to be able to
    > somehow convert that to a byte array to pass on to another class.
    > Does anyone have an elegant way to convert from a bufferedimage (or
    > MIS) to a byte array?

    MemoryImageSource takes byte or int array as argument
    1) if it was byte array - nothing to convert
    2) convert int array to byte array is easy work
    If you have BufferedImage:
    3) if you have BufferedImage than use getRGB() to get int array (see p. 2)

    --
    http://uio.dev.java.net
    http://reader.imagero.com
    ak, Jun 2, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Timo Nentwig

    J2ME: MemoryImageSource alike?

    Timo Nentwig, Mar 4, 2005, in forum: Java
    Replies:
    17
    Views:
    1,397
    Darryl Pierce
    Mar 22, 2005
  2. JariTapio

    MemoryImageSource and using it...

    JariTapio, May 8, 2005, in forum: Java
    Replies:
    1
    Views:
    4,311
    Thomas Fritsch
    May 9, 2005
  3. Replies:
    2
    Views:
    691
    Paul Schwann
    Aug 18, 2005
  4. Simon Andrews

    Write PNG from MemoryImageSource

    Simon Andrews, Feb 9, 2006, in forum: Java
    Replies:
    8
    Views:
    4,162
    Simon Andrews
    Feb 14, 2006
  5. Dashesy
    Replies:
    0
    Views:
    524
    Dashesy
    May 31, 2006
Loading...

Share This Page