Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have software that is possible to upload a photo but i can't reduce the size of photo
automatically into passport size resolution
Posted

1 solution

Try:
C#
/// <summary>
/// Create a thumbnail image.
/// </summary>
/// <param name="path">path to full size image</param>
/// <param name="width">Width of thumbnail</param>
/// <param name="height">Height of thumbnail</param>
public static Image GetThumbnailImage(string path, int width, int height)
    {
    using (Image image = Image.FromFile(path))
        {
        Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback);
        return image.GetThumbnailImage(width, height, myCallback, IntPtr.Zero);
        }
    }

C#
/// <summary>
/// This is not used in GDI+ 1.0, but must be supplied to some GDI calls.
/// E.g. Image.GetThumbnailImage
/// </summary>
/// <returns>false always</returns>
private static bool ThumbnailCallback()
    {
    return false;
    }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900