up vote 2 down vote favorite
share [g+] share [fb]

Possible Duplicate:
JPEG vs PNG vs BMP vs GIF

Whis is the best image format , provided less size and high resolution ?. Like while zooming and all , gives me a good picture ?

I know BMP has good resolution but the size is not affordable ?.

eg : I want to store some X-ray reports which should give me better resoluton while size is not so big ?

Thanks in advance

link|improve this question
Platform? What are viewing the images with? – AnthonyWJones Sep 23 '09 at 8:24
feedback

migrated from stackoverflow.com Sep 23 '09 at 8:34

This question came from our site for professional and enthusiast programmers.

closed as exact duplicate by Diago Oct 15 '09 at 12:12

This question covers exactly the same ground as earlier questions on this topic; its answers may be merged with another identical question. See the FAQ.

11 Answers

Like many questions that ask for a 'best' solution, the answer is:

It depends

There are many formats out there

  • TIFF for example can be set up in many ways, making it a complex but versatile format. This could be a winner for X-ray images
  • JPEG2000 is a wavelet-based image compression standard that can (if I'm not mistaken) provide the 'increased quality when zooming in'.

other formats include

  • BMP: an uncompressed bitmap, so quality and access-speed is great, but size is really bad.
  • JPEG: a lossy format, this means that saving the image degrades the quality, but has a descend compression and is great for photographs and stuff that do not need to be edited.
  • PNG: the 'new' GIF, it is lossless, can be compressed, can use (alpha)transparency
  • GIF: mostly useful for animations, for other uses PNG is better.
link|improve this answer
+1 for jpeg2000 – StampedeXV Sep 23 '09 at 8:39
4  
+1 also for mentioning basic things like "JPEG uses lossy compression but is good for photographs" and "BMP is uncompressed bitmap". Judging from the question (e.g. "BMP has good resolution" - um, what?), these kind of explanations were needed. – Jonik Sep 23 '09 at 9:18
Good answer! However, it might be a good idea to include a short explanation of lossy vs. lossless compression, and that lossless compression will always be much larger but it has to be used when all details need to be preserved. – Ilari Kajaste Sep 23 '09 at 10:19
feedback

If you are ok with a small quality loss, then - JPEG. If you need to store pictures as-is - consider looking to PNG.

link|improve this answer
+1, but I would add that PNG > JPEG, even whe you can afford a small quality loss, PNG is more efficient at compressing than JPEG. – Clement Herreman Sep 23 '09 at 8:27
4  
@Clement: that's not correct. PNG is a lossless format (there is no loss in picture quality) while JPEG is a lossy format. Being lossy allows JPEG to compress much more aggressively which result in smaller file sizes. Of course, this also depends on the content of the image: a photo is usually better suited for JPEG, while PNG excels on artificial images like graphs. – piquadrat Sep 23 '09 at 8:40
5  
You can't say PNG is more efficient than compressing than JPEG. They're both efficient, in different areas. For example, due to JPEGs complex sine wave algorithm compression, it is very good at compressing photos since they're more "random", while PNGs very good at images with fewer colors and more contrast (such as drawings and print graphics.) – Blixt Sep 23 '09 at 8:40
1  
For small 24bit color PNG images, 'no compression' can sometimes result in smaller filesize than 'max compression' so choose wisely. – Jacco Sep 23 '09 at 9:57
feedback

I want to store some X-ray report

For medical use these are usually held with little if any compression1, because quality is more important than file size (any one cannot be sure the tiny details that lossy compression would compromise are not importent).

If for illustration, rather than medical/scientific use, then use JPEG (X-Rays are photographs, just not of visible light).

1 Usually encapsulated in one of the many TIFF variants.

link|improve this answer
feedback

That depends on the content. X-ray is like a greyscale photo, right? So an greyscale JPEG would be nice, you can also embed EXIF-Data with the right software. PNG is also an option, also GIF is possible (8-Bit greyscale are often enough, but not sure for your usage).

All this formats compress the data. A high quality JPEG with greyscale (12-bit luminance) would be the best, i think.

link|improve this answer
GIF are pretty much always a worse idea than PNG's unless you require a GIF-specific feature: animation. – Eamon Nerbonne Sep 23 '09 at 8:33
feedback
  • JPG/JPEG This is the most widely used format for photos and images. It's lossy compression which means that you will lose quality in favor of image size. Does not support transparency.

  • PNG. It uses a loss-less compression, so that you will not lose any detail in your images. It supports transparency. Be aware that some older browsers doesn't support this format, if you need to display your images on the web.

  • GIF. This is only recommended if you use small images with very few colors. Uses a loss-less compression. Supports transparency.

Base on this, I would suspect that PNG would be best suited for your needs, since I imaging x-ray reports would be best to have loss-less compression in order to not lose any details.

link|improve this answer
Why would GIF be recommended over PNG, even for small images with few colors? These days I can think of only two valid (common) reasons for GIF. 1. If you need to have transparency and site statistics show that it's still being visited by IE6. 2. Animation. – Ilari Kajaste Sep 23 '09 at 10:27
feedback

JPEG is designed for photographs and paintings of realistic scenes so it should be OK for X-ray images of realistic scenes as well. So I would say JPEG, although, it is lossy.

On the other hand, it seems to be common practice to use TIFF for scientific imaging due to its precision. But it will probably not meet your size constraints.

link|improve this answer
feedback

In xkcd style:

enter image description here

link|improve this answer
feedback

TIF

RGB - 24 or 48 bits, Grayscale - 8 or 16 bits, Indexed color - 1 to 8 bits, Line Art (bilevel)- 1 bit

For TIF files, most programs allow either no compression or LZW compression (lossless, but is less effective for 24 bit color images). Adobe Photoshop also provides JPG or ZIP compression too (but which greatly reduces third party compatibility of TIF files). "Document programs" allow ITCC G3 or G4 compression for 1 bit text (Fax is G3 or G4 TIF files), which is lossless and tremendously effective (small).

RGB

RGB - 24 or 48 bits, Grayscale - 8 or 16 bits, Indexed color - 1 to 8 bits, Line Art (bilevel) - 1 bit

PNG uses ZIP compression which is lossless, and slightly more effective than LZW (slightly smaller files). PNG is a newer format, designed to be both verstile and royalty free, back when the LZW patent was disputed.

link|improve this answer
The possibilities of the TIFF format are not defined by vendor programs but rather by their format definition, there are a lot more possibilities with TIFF that are for example only/mostly used by specialised medical software. – Jacco Sep 23 '09 at 13:46
feedback

It depends. If you see carefully then you'll find that internet is dominated by jpg,gif and png. Sometimes you want use image for animation purpose with quality in that case gif stands on top of most image formats. While PNG is lossless and jpg is lossy format ( saving in jpg sometimes degardes picture quality ).

Answer to this is more or less: Gif. (i assume work involves transparency and animation ) Else PNG fits with Gif here as well.

link|improve this answer
feedback

Without knowing much about your environment I'd recommend png. It has good compression without too much image corruption (barely noticable in most cases) and it also supports transparency which is a nice bonus.

It's not magic though, insane resolutions will still result in large images if you want to avoid image corruption.

link|improve this answer
7  
PNG has no image corruption: it's lossless. – Eamon Nerbonne Sep 23 '09 at 8:33
feedback

I know it's not a direct answer, but still...

Storage devices are pretty cheap these days. Why not buy/install another disk and save the original bitmap (or the raw source format)? Or compress it using an external utility / library.

link|improve this answer
Actually, you easily can fill a huge disk with big pictures if stored in bmp. Transferring to other disk, over network, to memory sticks, to dvd and particularly compressing and uncompressing your data will turn to a nightmare. It's always a big difference to handle 1GB instead of 100GB. – user12099 Sep 23 '09 at 8:42
I still remember my 33k6 model from 20 years ago and the time I needed to download a bitmap of 2 megabytes... Ewwwww... Storage isn't the problem, transferring data is. – Wim ten Brink Sep 23 '09 at 9:19
feedback