Home > Net >  How to implement such a demand, thank you
How to implement such a demand, thank you

Time:11-20

Now N JPG files in one folder, inside for the certificates, now want to choose photos transverse file, is the picture of high & lt; Image width, could you tell me how to write, to thank you

CodePudding user response:

//traverse files get wide high
Image Image=Image. FromFile (path);//get photo, path for path
Int width=image. The width;//get wide
Int height=image. The height;//to get high

CodePudding user response:

Directory. GetFiles (@ "D: ", "*.jpg"), Where (p=& gt;
{
//to see how do you want to, don't tangled in the upstairs to read in the image, to tangle of 32 bytes read only the head, according to the JPG format to parse the wide high

}). ToList ();

CodePudding user response:

https://stackoverflow.com/questions/111345/getting-image-dimensions-without-reading-the-entire-file
If you want to tangle, is this way, the post don't know the format of the will, of course, throw exceptions, their processing

CodePudding user response:

I learn first, thanked first two upstairs

CodePudding user response:

'd better write a GetImg method, call after release resources
  •  Tags:  
  • C#
  • Related