Class ImageCropStyle
ImageCropStyle
סיווג שמייצג סגנון חיתוך שאפשר להחיל על רכיבי תמונה. אי אפשר להגדיר את הגודל של תמונה או לשנות את הגודל שלה, אבל אפשר לחתוך אותה.
מסמכים מפורטים
setAspectRatio(ratio)
מגדיר את יחס הגובה-רוחב שישמש אם סוג החיתוך הוא RECTANGLE_CUSTOM
. היחס חייב להיות ערך חיובי.
פרמטרים
שם | סוג | תיאור |
ratio | Number | היחס שיש להחיל. |
חזרה
ImageCropStyle
– האובייקט הזה, לצורך קישור.
זריקות
Error
– אם הקלט הוא שלילי או אפס.
setImageCropType(type)
הגדרת סוג החיתוך של התמונה. ברירת המחדל היא SQUARE.
פרמטרים
חזרה
ImageCropStyle
– האובייקט הזה, לצורך קישור.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 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"]]