• Post Reply Bookmark Topic Watch Topic
  • New Topic

Resizing JPG using Graphics2D

 
Terence Thant Zin Oo
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have the following code to resize the images.



I tried to resize these 2 photos -

pic1.jpg: JFIF standard 1.02, 4200x2800, 1.5 MB
pic2.jpg: EXIF standard, 2500x1900, 1.8 MB



It took a few seconds (3, 4 sec) to resize pic2.jpg but took more than one minute to resize pic1.jpg.

Is there any way to improve the performance the above code snippet?

Which attribute decide the performance of image resizing?
Is is the size of the image? or the resolution? or the encoding? or any other criteria?


Your advice would be really appreciated because I don't have much experience in image processing.


Thanks and regards
Terence

 
Mikko Kohtamäki
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try googling AffineTransformOp
 
Campbell Ritchie
Marshal
Posts: 52516
118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To expand about AffineTransforms: you can scale, translate, rotate or shear your Graphics object. Either use the AffineTransform class or those methods in the Graphics2Dclass.

Beware: because of the imprecision of floating-point arithmetic it is difficult to undo a transform (shear is the worst offender), so you are probably better off using a copy Graphics object from the create method of the graphics classes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!