> 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