--- license: apache-2.0 --- default image resizing method for wan 14B image-to-video pipelines (for both wan2.1 and wan 2.2 14B) ```py from diffusers import ModularPipeline image_processor = ModularPipeline.from_pretrained("YiYiXu/WanImageProcessor14B", trust_remote_code=True) image = image_processor( image="https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/wan_i2v_input.JPG", output="processed_image" ) ``` for wan 2.2 5B, the default method is here https://huggingface.co/YiYiXu/WanImageProcessor this is the code to resize ```py image = load_image( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/astronaut.jpg" ) max_area = 720 * 1280 aspect_ratio = image.height / image.width mod_value = pipe.vae_scale_factor_spatial * pipe.transformer.config.patch_size[1] height = round(np.sqrt(max_area * aspect_ratio)) // mod_value * mod_value width = round(np.sqrt(max_area / aspect_ratio)) // mod_value * mod_value image = image.resize((width, height)) ```