Class ImageSize
The size an image is drawn at, and its pixels, read from the header of its file alone, without its image data in memory: the size of a page laid out before its images are drawn, and an image refused early, for its size or for a header that Image refuses, before a byte of its image data is decoded.
The size is the one Image gives the image: its pixels, or the physical size the file asks for, the pHYs chunk of a PNG, the JFIF density of a JPEG or the pixels per metre of a BMP; a JPEG turned a quarter of the way by its Exif orientation is its height by its width. What only the image data shows, a JPEG cut short or the rows of a PNG, is Image's to refuse.
public sealed class ImageSize
- Inheritance
-
ImageSize
- Inherited Members
Methods
GetHeight()
The height the image is drawn at, in points, as Image's GetHeight before it is scaled.
public float GetHeight()
Returns
GetPixelHeight()
The height of the image in pixels, as stored.
public int GetPixelHeight()
Returns
GetPixelWidth()
The width of the image in pixels, as stored.
public int GetPixelWidth()
Returns
GetWidth()
The width the image is drawn at, in points, as Image's GetWidth before it is scaled.
public float GetWidth()
Returns
Read(Stream)
Reads the size of the PNG, JPEG or BMP image of the stream from its header, or throws why Image would refuse the image, as far as its header shows. A JPEG is read to its frame header, a BMP to its pixels per metre, and a PNG to its end, a chunk at a time, its image data checked and passed over, as a pHYs chunk may come after it. The stream is not closed.
public static ImageSize Read(Stream stream)
Parameters
streamStream
Returns
Read(string)
Reads the size of the PNG, JPEG or BMP file at the path.
public static ImageSize Read(string filePath)
Parameters
filePathstring