Class ImageCropStyle
ImageCropStyle
Class yang mewakili gaya pemangkasan yang dapat diterapkan ke komponen gambar. Anda tidak dapat menetapkan
ukuran gambar atau mengubah ukurannya, tetapi Anda dapat memangkas gambar.
Dokumentasi mendetail
setAspectRatio(ratio)
Menetapkan rasio aspek yang akan digunakan jika jenis pemangkasan adalah RECTANGLE_CUSTOM
. Rasio harus
bernilai positif.
Parameter
Nama | Jenis | Deskripsi |
ratio | Number | Rasio yang akan diterapkan. |
Pulang pergi
ImageCropStyle
— Objek ini, untuk pembuatan rantai.
Menampilkan
Error
— jika input negatif atau nol.
setImageCropType(type)
Menetapkan jenis pemangkasan untuk gambar. Default-nya adalah SQUARE.
Parameter
Pulang pergi
ImageCropStyle
— Objek ini, untuk pembuatan rantai.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2024-12-02 UTC.
[null,null,["Terakhir diperbarui pada 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"]]