ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Getting image file info without opening the image

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
mkjaie Posted - Feb 10 2018 : 17:09:06
What is the simplest form of code to get image file information (height and width in pixels, as well as any other info) without actually opening the image?
Thanks

Michael K. Johnson
1   L A T E S T    R E P L I E S    (Newest First)
w2m Posted - Feb 10 2018 : 20:05:34
TImageEnIO.ParamsFromFile

Declaration

function ParamsFromFile(const FileName: WideString; bUseExtension: Boolean = False): Boolean; overload;
function ParamsFromFile(const FileName: WideString; Format: TIOFileType): Boolean; overload;


Description

Reads the image properties without loading the image (and without changing the current image). Result is false if a loading error is encountered due to a corrupt or unknown image format.

In other words, ParamsFromFile is the same as calling LoadFromFile but without retrieving the image.

FileName is the file name with full path.
Format is the file format that the stream or file contains. If ioUnknown is specified then the file content is analyzed to determine the format.
bUseExtension determines that the file format is based on the extension of the file, e.g. image.jpeg will be processed as ioJPEG format.

Examples

// Load the parameters of an image (which may be a BMP file, but we will examine the content to be sure)
ImageEnView1.IO.ParamsFromFile( 'C:\alfa.bmp' );
Label1.Caption := 'alfa.bmp has ' + inttostr(ImageEnView1.IO.Params.BitsPerSample) + ' bits per sample';
Label2.Caption := 'alfa.bmp has ' + inttostr(ImageEnView1.IO.Params.Width) + ' width';


Help: https://www.imageen.com/help/TImageEnIO.ParamsFromFile.html



Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development