Class ImageCropStyle
ImageCropStyle
Una classe che rappresenta uno stile di ritaglio che può essere applicato ai componenti immagine. Non puoi impostare le dimensioni di un'immagine o ridimensionarla, ma puoi ritagliarla.
Documentazione dettagliata
setAspectRatio(ratio)
Imposta le proporzioni da utilizzare se il tipo di ritaglio è RECTANGLE_CUSTOM
. Il rapporto deve essere un valore positivo.
Parametri
Nome | Tipo | Descrizione |
ratio | Number | Il rapporto da applicare. |
Invio
ImageCropStyle
: questo oggetto, per l'accodamento.
Lanci
Error
: se l'input è negativo o uguale a zero.
setImageCropType(type)
Imposta il tipo di ritaglio per l'immagine. Il valore predefinito è SQUARE.
Parametri
Invio
ImageCropStyle
: questo oggetto, per l'accodamento.
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2024-12-02 UTC.
[null,null,["Ultimo aggiornamento 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"]]