An easy-to-use C# library that determines the dimensions (width and height) of images in various formats, without relying on external libraries.
- PNG
- JPEG
- BMP
- GIF
- TIFF
Via NuGet Copy code
Install-Package ImageSize
Or search for ImageDimensionDetector in the NuGet Package Manager.
Download the latest release and add the .dll file to your C# project.
using ImageSize;
...
Stream imageStream = File.OpenRead("path_to_your_image_file");
var dimensions = ImageSize.GetImageSize(imageStream);
if(dimensions.HasValue)
{
Console.WriteLine($"Width: {dimensions.Value.width}, Height: {dimensions.Value.height}");
}
else
{
Console.WriteLine("Unsupported image format or invalid image file.");
}
Fork the repository. Create your feature branch.
git checkout -b feature/YourFeatureName
Commit your changes.
git commit -am 'Add some feature'
Push to the branch.
git push origin feature/YourFeatureName
Open a pull request.
If you discover a bug or have a suggestion, please open an issue.
This project is licensed under the MIT License. See the LICENSE file for details.