mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-22 15:29:44 +00:00
Refactor node image upload and preview (#2580)
Co-authored-by: huchenlei <huchenlei@proton.me>
This commit is contained in:
12
src/utils/imageUtil.ts
Normal file
12
src/utils/imageUtil.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export const is_all_same_aspect_ratio = (imgs: HTMLImageElement[]): boolean => {
|
||||
if (!imgs.length || imgs.length === 1) return true
|
||||
|
||||
const ratio = imgs[0].naturalWidth / imgs[0].naturalHeight
|
||||
|
||||
for (let i = 1; i < imgs.length; i++) {
|
||||
const this_ratio = imgs[i].naturalWidth / imgs[i].naturalHeight
|
||||
if (ratio != this_ratio) return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user