Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Image compression on client side  RSS feed

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am working in social site ,In which client can upload multiple images of any size.

But problem is while uploading much more size image, application giving error related to perm space. To solve this issue i am planning to compress image on client side. For that i feel applet is one option.

but i dont know how i combine applet code with jquery.? OR is there any option for image compression in client side or server side?


Need help


Thanks in advance
 
Saloon Keeper
Posts: 4702
117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How much permgen space are you allocating to the JVM?

Resizing an image is probably easier (and less memory hungry) if you do it through ImageMagick via a script.
 
Ramesh Sengani
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am giving permgen space : 256 m .

Is not any API for image compression ?
 
Tim Moores
Saloon Keeper
Posts: 4702
117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you dig into the JPEG compression parameters of javax.imageio.ImageIO.write then you can specify the compression factor. If you search these forums you'll find relevant code examples of that.
 
Ramesh Sengani
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim for reply on post.

But i need on client side. As per your post you are saying about java code means applet.But i am not get proper direction how i make that possible ..need some more clarification
 
Rancher
Posts: 2762
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you think compressing the uploaded image is going to solve your permgen issue? Permgen issue generally happens because you load too many classes into the JVM (but can happen because of other reasons too). How is adding new classes to the code going to reduce the permgen usage?

You might want to increase your permgen a little bit and then monitor it while running your app under moderate load to check if it increases with usage. If it stays flat, just use the permgen setting that works for you.
 
Rancher
Posts: 4686
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The basic idea here, that client side compression will help is fatally flawed.

At least 99% of images that users are likely to upload are JPEG files. They are already compressed. Compressing them again will not reduce their size, and will typically increase the file size.

You need to approach your problem from a different direction.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!