views:

318

answers:

3

I want to check out whether the photograph is suitable for print or not using my application.How can I do that?I don't know much about photo quality?Is the resolution of every photograph is same or not?

A: 

This might help http://support.microsoft.com/kb/324790

Sorantis
A: 

There are a great many factors that will differentiate an image that is "of good quality" and "of bad quality"

wikipedia has a short list of those factors

Most of these are rather hard to check for programatically and involve complex imaging algorithms. Checking for resolution is easy however, if it is the only criteria between a good and a bad image.

This simple code tells you how to do it

I think the most basic code to get resolution is this

  Bitmap bmp = new Bitmap("winter.jpg");

  Console.WriteLine("Image resolution: " + bmp.HorizontalResolution + " DPI");
  Console.WriteLine("Image resolution: " + bmp.VerticalResolution + " DPI");
  Console.WriteLine("Image Width: " + bmp.Width);
  Console.WriteLine("Image Height: " + bmp.Height);
Eric
Thank you.with which value should I compare the image resolution?
C. Karunarathne
+3  A: 

I think the only factor in print quality that you can check with any certainty (because the other factors are subjective), is the resolution of the image vs. the intended print size. If you have other tangible requirements, like the image must be color, not black and white, you can check for that too. But trying to identify whether an image is too blurry, low contrast, etc., will likely be a fruitless pursuit, as you never know whether the image was intended to be that way or not.

A common rule of thumb is that you should have at least 240 dots per inch when printing, and 300 is even better. Of course with quality printers, higher resolution than that can yield better results, and if you are printing very high detail, like fine text, you may want to go to 600dpi and above.

So to print an 8" x 10" image using the minimum figure of 240 dpi, you would want an image that is at least 1920 x 2400 pixels (a total of 4,608,000 pixels, or about 4.5 megapixels).

If you decide you want at least 300dpi when printing an 8" x 10", then you want an image with at least 2400 x 3000 pixels, which is about 7 megapixels.

Stepping up to 600dpi? You'll need about a 28 megapixel image in that case.

Example:

using System;
using System.Drawing;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int minimumPrintDpi = 240;
            int targetPrintWidthInches = 8;
            int targetPrintHeightInches = 10;
            int minimumImageWidth = targetPrintWidthInches * minimumPrintDpi;
            int minimumImageHeight = targetPrintHeightInches * minimumPrintDpi;

            var img = Image.FromFile(@"C:\temp\CaptainKangaroo.jpg");

            Console.WriteLine(string.Format("Minimum DPI for printing: {0}", minimumPrintDpi));
            Console.WriteLine(string.Format("Target print size: width:{0}\" x height:{1}\"", targetPrintWidthInches, targetPrintHeightInches));
            Console.WriteLine(string.Format("Minimum image horizontal resolution: {0}", minimumImageWidth));
            Console.WriteLine(string.Format("Minimum image vertical resolution: {0}", minimumImageHeight));
            Console.WriteLine(string.Format("Actual Image horizontal resolution: {0}", img.Width));
            Console.WriteLine(string.Format("Actual Image vertical resolution: {0}", img.Height));
            Console.WriteLine(string.Format("Actual image size in megapixels: {0}", ((float)img.Height * img.Width) / 1000000));
            Console.WriteLine(string.Format("Image resolution sufficient? {0}", img.Width >= minimumImageWidth && img.Height >= minimumImageHeight));
            Console.WriteLine(string.Format("Maximum recommended print size for this image: width:{0}\" x height:{1}\"", (float)img.Width / minimumPrintDpi, (float)img.Height / minimumPrintDpi));

            Console.ReadKey();
        }
    }
}
RedFilter
How can I check whether the image is having 300DPI?When I get img.HorizontalResolution and img.VerticalResolution it gives them as 96 and 96. What is that mean?
C. Karunarathne
Use Width and Height properties as I showed above, and see if there are enough pixels for the size yu want to print at by multiplying number of inches by 240 and comparing with your available resolution in image.
RedFilter
"your available resolution in image" is that getting by img.HorizontalResolution and img.VerticalResolution?
C. Karunarathne
No, it is by using the Width and Height properties as above.
RedFilter
float hres = image.Height/240;float vres = image.Width/240;float imageHeight = image.Height/image.HorizontalResolution;float imagewidth= image.Width/image.VerticalResolution;As image height and width is given by pixels I want to compare those above hres with imageHeigth and vres with imageWidth?Is that correct?
C. Karunarathne
I misunderstood - I thought you wanted programming help, but you actually need help with the math. I'll post back in a bit.
RedFilter
See updated example.
RedFilter
Thank you.Further can I check whether the noise is added to photo?
C. Karunarathne