AntoniRyszard
asked on
Apache FileUpLoad and BufferedImage?
Hello,
I am planning to use the apache fileupload tool, to access images posted to a servlet.
The servlet accesses the files using:
List items = upload.parseRequest(req);
while(iter.hasNext()){
FileItem item = (FileItem) iter.next();
}
My plan was to create a thumbnail of the orginal image, and this and orginal image.
Could anyone advise if I could possibly create an BufferedImage object or Image object from the item variable above, and then reduce the image size using the bufferedimage?
Thank you
I am planning to use the apache fileupload tool, to access images posted to a servlet.
The servlet accesses the files using:
List items = upload.parseRequest(req);
while(iter.hasNext()){
FileItem item = (FileItem) iter.next();
}
My plan was to create a thumbnail of the orginal image, and this and orginal image.
Could anyone advise if I could possibly create an BufferedImage object or Image object from the item variable above, and then reduce the image size using the bufferedimage?
Thank you
ASKER
Thanks I'll try this,
Do you think this would work for gif and png images as well?
Could you offer any advise in creating an thumbnails from the orginal.
I thought it would be difficult to make all the thumbnails one size automatically. Perhaps I should take a width, height of the orginal image and determine from this if I should scale down by 50%, 25%.
Thanks
Do you think this would work for gif and png images as well?
Could you offer any advise in creating an thumbnails from the orginal.
I thought it would be difficult to make all the thumbnails one size automatically. Perhaps I should take a width, height of the orginal image and determine from this if I should scale down by 50%, 25%.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>Do you think this would work for gif and png images as well?
Are you using Java 5 ?
ImageIO has readers for jpg, png, and gif . Writers for jpg and png, I am not sure about gif. You might have to use Acme.com package.
Hopefully we will get some help from experts. I am not real expert in Image code.
Are you using Java 5 ?
ImageIO has readers for jpg, png, and gif . Writers for jpg and png, I am not sure about gif. You might have to use Acme.com package.
Hopefully we will get some help from experts. I am not real expert in Image code.
ASKER
Thanks
I am not very use to the Image or AffineTransform classes. I will look into these.
Thanks
I am not very use to the Image or AffineTransform classes. I will look into these.
Thanks
BufferImage bi = ImageIO.read(item.getInput