Image content compression

Discussion in 'Java' started by Kannan, Nov 14, 2005.

  1. Kannan

    Kannan Guest

    Hi,
    Does someone know of any java api's libraries for image compression. I
    am not looking for compression into zip. For example a gif file is much
    smaller than a jpg file (this is because some information about editing
    the page is lost in gif file).

    Basically the image file is available as a byte stream (InputStream). I
    want to compress the bytes and store image into a database. The image
    will be only read from db and noone will be editing the image (which
    means that it is okay to loose editing information while compression).

    Are there any APIs for this?
    Kannan, Nov 14, 2005
    #1
    1. Advertising

  2. Kannan wrote:

    > Does someone know of any java api's libraries for image compression. I
    > am not looking for compression into zip. For example a gif file is much
    > smaller than a jpg file


    Not always, no. A GIF made from a JPEG with high
    compression can actually trun out larger.

    >..(this is because some information about editing
    > the page is lost in gif file).


    GIF format only supports 256 colors.

    > Basically the image file is available as a byte stream (InputStream). I
    > want to compress the bytes and store image into a database. The image
    > will be only read from db and noone will be editing the image (which
    > means that it is okay to loose editing information while compression).
    >
    > Are there any APIs for this?


    You can use the javax.imageio.ImageIO class to write the
    image as JPEG or PNG format, but core Java (until 1.6)
    does not support writing GIF's. You will require a
    third-party API/source for writing GIF's pre 1.6.

    HTH
    Andrew Thompson, Nov 14, 2005
    #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. William Ortenberg

    Image compression

    William Ortenberg, Jul 21, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    418
    Viktor Popov
    Jul 21, 2004
  2. =?Utf-8?B?UGFyYWtp?=

    Image size problem. Image Compression

    =?Utf-8?B?UGFyYWtp?=, Jun 24, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    491
    Kevin Spencer
    Jun 24, 2005
  3. Alex Zorin
    Replies:
    3
    Views:
    391
  4. Chris
    Replies:
    1
    Views:
    383
    Andrew Thompson
    Nov 17, 2005
  5. hazz
    Replies:
    6
    Views:
    49,556
    SkyUCHC
    Jun 9, 2010
Loading...

Share This Page