Class ImageCropStyle
ObrazPrzytnijStyl
Klasa reprezentująca styl przycinania, który można zastosować do komponentów obrazu. Nie możesz zmienić rozmiaru obrazu, ale możesz go przyciąć.
Szczegółowa dokumentacja
setAspectRatio(ratio)
Ustawia współczynnik proporcji, który ma być używany, jeśli typ przycięcia to RECTANGLE_CUSTOM
. Współczynnik musi być wartością dodatnią.
Parametry
Nazwa | Typ | Opis |
ratio | Number | Stosowany współczynnik. |
Powrót
ImageCropStyle
– ten obiekt do łańcucha.
Rzuty
Error
– jeśli dane wejściowe mają wartość ujemną lub zero.
setImageCropType(type)
Ustawia typ przycięcia obrazu. Wartość domyślna to SQUARE.
Parametry
Powrót
ImageCropStyle
– ten obiekt do łańcucha.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2024-12-02 UTC.
[null,null,["Ostatnia aktualizacja: 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"]]