หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Cropping Images

Updated on 2024-10-24 GMT+08:00

Common Cropping

You can edit code on OBS Console or make an API call to crop images.

You can start at any point on an image and crop the image into a rectangle with specified width and height. Table 1 describes the parameters.

This operation is represented by crop.

Table 1 Common cropping parameters

Parameter

Value Description

Code Example

g

The location where cropping starts. g can be set to tl, top, tr, left, center, right, bl, bottom, or br. Figure 1 shows a 3×3 grid illustrating these values. Each value locates at the top left corner of the cell.

image/crop,x_10,y_10,w_200,h_200,g_br

h

Cropping height. Its value ranges from 0 to Original height.

w

Cropping width. Its value ranges from 0 to Original width.

x

x-coordinate of the start point. The top left corner is the default origin. The parameter value ranges from 0 to Original image width.

y

y-coordinate of the start point. The top left corner is the default origin. The parameter value ranges from 0 to Original image height.

Figure 1 shows the cropping origins.

Figure 1 3×3 grid of cropping origins
NOTE:
  • If x is larger than the origin width, or y is larger than the origin height, the cropping cannot be executed and a fault will be returned.
  • If h is larger than the origin height and w is larger than the original width, the image will be cropped to the boundaries.

Inscribed Circles

You can edit code on OBS Console or make an API call to get an inscribed circle of an image.

Choose the image center as the center of a circle, and crop the image according to the specified radius. The image then is cropped into a circle. Table 2 describes the parameters.

This operation is represented by circle.

Table 2 Inscribed circle parameters

Parameter

Value Description

Code Example

r

Radius specified for the inscribed circle. Its value ranges from 0 to Half of the image's short side.

image/circle,r_100

NOTE:
  • If the output format is set to JPG, the area outside the inscribed circle is white. If the output format is set to a vector format such as PNG, WebP, or BMP, the area outside the inscribed circle is transparent. PNG is the recommended output format.
  • Even if r is larger than half of the short side, the generated inscribed circle is still the image's largest inscribed circle (with a radius equal to half of the short side).

Indexcropping

You can edit code on OBS Console or make an API call to indexcrop images.

Set the top left corner of the image as the starting point. Set x-axis overlapping with the width, and y-axis overlapping with the height. Crop the image into several consecutive partitions horizontally or vertically, each having equal width or height. Get the partition you want according to the index. Table 3 describes the parameters.

This operation is represented by indexcrop.

Table 3 Indexcropping parameters

Parameter

Value Description

Code Example

x

Width of each partition in horizontal cropping, ranging from 1 to Original image width. x and y cannot be chosen at the same time.

image/indexcrop,x_1000,i_0

y

Height of each partition in vertical cropping, ranging from 1 to Original image height.

x and y cannot be chosen at the same time.

i

If there are n partitions in total, the value of i ranges from 0 to n–1. When i is set to 0, you obtain the first partition. If you set i to a value larger than n–1, the original image will be returned.

Rounded Corner Cropping

You can edit code on OBS Console or make an API call to round corners of an image.

This operation allows you to cut off the corners of an image based on the specified radiuses. You can configure the radius of image corners to round in two ways. For details, see Table 4.

This operation is represented by rounded-corners.

Table 4 Rounded corner parameters

Parameter

Value Description

Code Example

r

It indicates both horizontal and vertical radiuses of image corners you will round. You can configure it by using the number of pixels (for example, 200) or the percentage (for example, 25p).

The number of pixels ranges from 1 to 4096. If this number is greater than half of the original image's short side, the half of the short side is applied.

The percentage ranges from 1p to 50p.

r cannot be used together with rx or ry.

image/rounded-corners,r_100

rx

It indicates the horizontal radius of image corners you will round. You can configure it by using the number of pixels (for example, 200) or the percentage (for example, 25p).

The number of pixels ranges from 1 to 4096. If this number is greater than half of the original image's short side, the half of the short side is applied.

The percentage ranges from 1p to 50p.

rx must be used together with ry.

image/rounded-corners,rx_100,ry_200

ry

It indicates the vertical radius of image corners you will round. You can configure it by using the number of pixels (for example, 200) or the percentage (for example, 25p).

The number of pixels ranges from 1 to 4096. If this number is greater than half of the original image's short side, the half of the short side is applied.

The percentage ranges from 1p to 50p.

ry must be used together with rx.

NOTE:

If the output image format is JPG, the cut-out corner area is white. If the output image format is PNG, WebP, or BMP, the cut-out corner area is transparent. You are advised to save rounded corner images in PNG.

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback