c# - Determine if image is square -


is there quick method determine if image square or not in c#?

question has been phrased incorrectly, apologies.

is there way determine if image can scaled "down" fit square block, without cropping either height or width, example, if have 960x640, have square, on it's width, if have 640x960, don't.

i need able determine if image can scaled down 100% square block, example, 150x150, without losing portions of image.

update

let me try again.

i have iterate collection of images:

960x658 960x566 960x381 960x378 714x960 658x960

i know, first 2 images square (150x150), know middle 2 rectangular (horizontal) (300x150) , know remaining 2 rectangular (vertical) (150x300). there algorithm, 3rd party component or built in method determine me?

i don't want go , code nested spaghetti code using if statements this? i'm lost :$

is there quick method determine if image square or not in c#?

well you're pretty giving answer yourself. have image. have image's properties.

if(img.width == img.height)     //i'm square 

now since you're iterating through collection of images.

foreach(image img in myimagecollection)     if(img.width == img.height)        squareimages.add(img); 

as simple that.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -