Class ImageCropStyle
画像切り抜きスタイル
画像コンポーネントに適用できる切り抜きスタイルを表すクラス。画像のサイズを設定したり、サイズを変更したりすることはできませんが、画像を切り抜くことはできます。
詳細なドキュメント
setAspectRatio(ratio)
切り抜きタイプが RECTANGLE_CUSTOM
の場合に使用するアスペクト比を設定します。比率は正の値にする必要があります。
パラメータ
戻る
ImageCropStyle
- チェーン用のこのオブジェクト。
例外
Error
- 入力が負数または 0 の場合。
setImageCropType(type)
画像の切り抜きタイプを設定します。デフォルトは SQUARE です。
パラメータ
戻る
ImageCropStyle
- チェーン用のこのオブジェクト。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-12-02 UTC。
[null,null,["最終更新日 2024-12-02 UTC。"],[[["`ImageCropStyle` allows cropping images within Google Apps Script, but not resizing them directly."],["Two main methods, `setAspectRatio` and `setImageCropType`, provide control over the cropping process."],["`setAspectRatio` is applicable only when using the `RECTANGLE_CUSTOM` crop type and requires a positive ratio value."],["`setImageCropType` lets you choose the shape of the crop, with `SQUARE` being the default option."],["Both methods return the `ImageCropStyle` object, enabling method chaining for streamlined code."]]],["The `ImageCropStyle` class allows users to crop images without resizing them. Key actions include setting the image crop type using `setImageCropType`, which defaults to SQUARE. For a `RECTANGLE_CUSTOM` crop type, you can set the aspect ratio via `setAspectRatio`, which requires a positive numeric value. Both methods return the `ImageCropStyle` object, enabling method chaining. `setAspectRatio` throws an error if the ratio is zero or negative.\n"]]