Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet generating an image

 
Manish Hatwalne
Ranch Hand
Posts: 2591
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this servlet which generates an image dynamically and sends it to the client. This image can be sent as a PNG or JPEG; which is more convenient if quality of the image is not a major concern?
- Manish
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're not measuring based on quality, how are you defining 'convenience'?
I'd tend to say JPEG over PNG, since I'm not sure that PNG is widely accepted.
 
Manish Hatwalne
Ranch Hand
Posts: 2591
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David O'Meara:
[QB]If you're not measuring based on quality, how are you defining 'convenience'?
QB]

Speed or network bandwidth!
- Manish
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which is purely size. In this case you are really looking at apples and oranges.
My understanding is that PNG is close to GIF in that it gets better performance with images that have a limitted number of colors, like cartoon type graphics.
JPEGs are better for photo style images with large numbers of colors and color gradients.
Viewed that way, if you are creating images in a servlet is might be the case that they are closer to the cartoon style and would therefore be better as PNGs. You may find that a JPG of a comparable size has significant dithering and is less useful.
 
Manish Hatwalne
Ranch Hand
Posts: 2591
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right! Images would be mostly Maps/Vharts etc, so I think PNG would be a better option as compared to JPEG.
Are there any stats avaialable about the PNG support by browsers?
- Manish
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic