Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

need to do this image work without AWT - Swing  RSS feed

 
DC Dalton
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I know this is going to sound strange but I tried over in the servlets section and have been beating my head trying to figure it out for two days..

what i need to do is replace this code (in a servlet):

Graphics2D graphics2D = thumbImage.createGraphics();
graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
graphics2D.drawImage(image, 0, 0, thumbWidth, thumbHeight, null);

With some other way to do the exact same thing without calling anything that will try to evoke the X-Windows server on a Linux server (we dont have it installed)

Ive got all the image reading and writing, scaling and everything else done but this section tries to call the X-Windows server and throws an exception. When I remove this from the code my images are scaled but come out solid black..

Im hoping someone here can help as Ive tried about everything I can think of!

thanks
 
Suman Mummaneni
Ranch Hand
Posts: 96
Android Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dalton ,

Looks like you are trying to create a graphics. But I did not get you when said replace the code on a servlet.
 
DC Dalton
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No Im scaling images that are uploaded to a web site (scaling and optimizing) .... thats where the problems started
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DC,

I replied to this in the Servlets forum. See if that is any help to you. Cheers.
 
Suman Mummaneni
Ranch Hand
Posts: 96
Android Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well did you try out BufferedImage. It has various method to do the scaling of images. If you want to avoid completely the AWT and Swing. The best option for you will be to create a C file that creates the thumbnail for you then use JNI call to access this file. C provides pointers for access bit of a file where you could perform scaling and optimizing more effectively
-Cheers
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!