This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to make all Image of Same width and Height Before Uploading to database?  RSS feed

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I am working on a web application in Which I ask user to upload an Image.When user Uploads Images then they are in different sizes and resolutions

I want to make all of them to fixedwidth*fixedHeight before I upload them to database(At this I am neglecting their quality)

How can I do this?

(I know this question is not directlt related to servlets but posting this question in Java in General and Begining Java I think is difficult to answar.But moderators decision is final)

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, nothing in servlets to help. You might check things like media frameworks classes. I've moved this post accordingly.
 
Rob Spoor
Sheriff
Posts: 21092
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do this with external libraries, but perhaps JSE provides enough support for this, in the form of a scaling ImageFilter. You can use an AreaAveragingScaleFilter for the scaling itself. With an Image (which you can create using the ImageIO class) you can then perform the scaling quite easily:

 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!