Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Code to create thumbnails

 
Paul Anavian
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to figure out how to write code that will create a thumbnail of an existing uploaded image. I know how to make a thumbnail manually, what I need is code to generate thumbnails as soon as a user uploads an image via a form. Please Help!!!
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anavian,
Javaranch has a naming policy which is strictly enforced. Please change your display name to conform with this policy if you wish to keep posting here. Thanks.
 
Michael Yuan
author
Ranch Hand
Posts: 1427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can call external programs to generate the thumbnails from the java.lang.Runtime API.
One good image handling package is imagemagick (www.imagemagick.org)
Imagemagick also has a JNI based Java API (http://www.yeo.nu:81/jmagick/)
 
Prashanth menon
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anavian:
I am trying to figure out how to write code that will create a thumbnail of an existing uploaded image. I know how to make a thumbnail manually, what I need is code to generate thumbnails as soon as a user uploads an image via a form. Please Help!!!

hi
It is the same as manual method. Only that the image here will be dynamically loaded. We can write a servlet that returns an image after reading it in a particular image format.
classes From Graphics2D or JavaAdvancedImaging API would help serve the purpose
There are also lots of other imagedecoder classes available
prashanth
 
Paul Anavian
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info I'll check it and let you know how it turns out.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic