posted 13 years ago
Thanks Andrey :-)
I did not get the chance to look at the method suggested by you. I am very new to Graphics2D. I tried to use drawImage method of Graphics2D.
My requirement is I need to scaledown (or compress/reduce the size(KB) of the image) the image to some size (say 50000 bytes for my application) keeping the dimensions same.
Code I have written till now is
the way I am calling the above method is
(I have hard coded the dimensions currently because my original image is 800*600)
Now I finding on this code is:-
Image is getting downscaled to some size (dimensions same). I tried with few images. Getting different size for different images.
For example 1) My original image was around 38000 bytes and the new image after invoking the above code is around 6000 bytes.
2) My original image was around 64000 bytes and the new image after invoking the above code is around 53000 bytes.
My question is - Can not I control the size of image (keeping the dimesnions same). I want to dowmscale the image (keeping the dimensions same) to 50000 bytes if the size of the original image is more than 50000 bytes.
Please suggest some solution