
Aspose.Imaging Cloud SDK for Python
Python REST API를 사용하여 이미지를 생성하고 변환
이미지 처리를 위한 Python REST SDK를 사용하면 소프트웨어 개발자가 이미지를 생성, 편집, 압축, 조작, 변환 및 압축할 수 있습니다.
이미지는 소셜 미디어, 광고, 의료 등의 분야에 응용되는 현대 커뮤니케이션의 필수적인 부분입니다. 이미지를 효율적이고 정확하게 만들고 처리하는 것은 많은 현대 기업에 매우 중요한 요구 사항입니다. 다행히도 Aspose.Imaging Cloud SDK for Python은 이미지 작업을 위한 포괄적인 솔루션을 제공하여 소프트웨어 개발자가 생성, 변환, 크기 조정, 자르기, 보기, 인쇄 등과 같은 다양한 중요한 작업을 수행할 수 있도록 합니다. Aspose.Imaging Cloud SDK for Python의 주요 장점 중 하나는 소프트웨어 개발자가 특수 소프트웨어나 하드웨어 없이도 이미지를 처리할 수 있다는 것입니다.
Aspose.Imaging Cloud SDK for Python은 개발자가 BMP, GIF, JPEG, JPEG2000, PSD, TIFF, WEBP, PNG, WMF, EMF, SVG 등과 같은 다양한 형식의 다양한 유형의 이미지로 작업할 수 있도록 해주는 클라우드 기반 API입니다. 이미지에서 메타데이터 추출, 색상 관리 지원, 이미지의 여러 레이어 작업, 레이어 추가/제거 또는 수정, 이미지에 워터마크 추가(텍스트 및 이미지 워터마크), 이미지 뒤집기 및 회전, 이미지 방향 문제 수정, 이미지 관점 변경 등 여러 가지 중요한 기능도 라이브러리에 포함되어 있습니다.
Aspose.Imaging Cloud SDK for Python은 매우 쉽게 다룰 수 있으며, 개발자가 PNG 이미지를 JPEG 또는 BMP로 변환하는 것처럼 이미지를 한 형식에서 다른 형식으로 쉽게 변환할 수 있습니다. SDK는 광범위한 이미지 형식을 지원하여 매우 다재다능합니다. SDK의 또 다른 매우 유용한 기능은 사용자가 SDK로 이미지 크기를 조정할 수 있다는 것입니다. 이는 소셜 미디어 게시물이나 웹사이트 디자인과 같은 특정 목적에 맞게 이미지를 최적화하는 데 유용합니다. SDK는 비례 및 비비례 크기 조정을 모두 지원합니다. 게다가 사용자가 이미지를 잘라서 원치 않는 부분을 제거하거나 관심 있는 특정 영역에 집중할 수 있습니다. 사용자는 자르기 영역 및 자르기 모드와 같은 자르기 매개변수를 지정할 수 있습니다.
Aspose.Imaging Cloud SDK for Python 시작하기
Aspose.Imaging Cloud SDK for Python을 설치하는 권장 방법은 PyPi를 사용하는 것입니다. 원활한 설치를 위해 다음 명령을 사용하세요.
PyPi를 통해 Python용 Aspose.Imaging Cloud SDK 설치
pip install aspose-imaging-cloud
Aspose 제품 페이지에서 직접 다운로드할 수도 있습니다.Python API를 통한 클라우드에서 이미지 읽기 및 쓰기
Python용 Aspose.Imaging Cloud SDK는 컴퓨터 프로그래머가 초기 비용 없이 클라우드에서 생성, 조작 및 변환을 포함한 광범위한 이미지 처리 작업을 수행할 수 있도록 하는 매우 유용한 REST API입니다. 이 라이브러리에는 일부 인기 있는 이미지 파일 형식에 대한 지원이 포함되어 있으며 BMP, GIF, JPEG, JPEG2000, PSD, TIFF, WEBP, PNG, WMF, EMF, SVG, TGA, APNG 등과 같은 이미지 파일 형식을 읽고 쓸 수 있습니다. 이미지가 생성되면 소프트웨어 개발자는 필요에 따라 이미지를 쉽게 로드하고 수정할 수 있습니다. 다음 예는 사용자가 클라우드 스토리지에서 이미지를 읽는 방법을 보여줍니다.
Python을 통해 클라우드 저장소에서 이미지를 읽고 쓰는 방법은 무엇입니까?
# set the input image path and format
name = 'input_image.jpg'
format = 'jpg'
folder = 'your_folder_path'
# send the request to the API to download the image
response = imaging_api.get_image_download(name, folder=folder, format=format)
# read the image data from the response
image_data = response.content
# Write an Image to the Cloud Storage via Python API
# set the output image path and format
name = 'output_image.jpg'
format = 'jpg'
folder = 'your_folder_path'
# send the request to the API to upload the image
response = imaging_api.create_updated_image(name, image_data, folder=folder, format=format)
# read the response to confirm the image was uploaded successfully
if response.status_code == 200:
print('Image uploaded successfully.')
else:
print('Error uploading image:', response.content)
Python API를 통한 이미지 크기 조정, 자르기 및 회전
Python용 Aspose.Imaging Cloud SDK를 사용하면 소프트웨어 개발자가 자체 클라우드 애플리케이션 내에서 다양한 이미지 조작 작업을 수행할 수 있습니다. 크기 조정 작업을 수행하려면 개발자가 이미지를 Cloud Storage에 업로드한 다음 API URL에 이름을 전달해야 합니다. 이미지 매개변수를 업데이트한 후 API는 응답에서 업데이트된 이미지를 반환합니다. REST API에는 이미지 회전, 뒤집기, 이미지 크기 조정, 기존 이미지 자르기, TIFF 이미지를 다른 이미지에 추가 등과 같은 여러 가지 중요한 다른 기능이 포함되어 있습니다.
Python API를 통해 이미지 크기를 조절하거나 자르는 방법?
import asposeimagingcloudsdk
from asposeimagingcloudsdk.models.requests import CreateResizedImageRequest, CreateCroppedImageRequest
# Initialize Aspose.Imaging Cloud API client
imaging_api = asposeimagingcloudsdk.ImagingApi(api_key='YOUR_API_KEY', app_sid='YOUR_APP_SID')
# Set the input image file name and format
filename = 'input_image.jpg'
format = 'jpg'
# Set the output image file name and format
output_filename = 'output_image.jpg'
output_format = 'jpg'
# Set the new size for the resized image
new_width = 500
new_height = 500
# Set the coordinates and size of the area to be cropped
x = 50
y = 50
width = 400
height = 400
# Create a request object for creating the resized image
resize_request = CreateResizedImageRequest(filename, new_width, new_height, format, output_format, folder='input')
# Call the API to resize the image and save the result to the cloud storage
response = imaging_api.create_resized_image(resize_request)
# Create a request object for creating the cropped image
crop_request = CreateCroppedImageRequest(output_filename, output_format, x, y, width, height, format, folder='output')
# Call the API to crop the image and save the result to the cloud storage
response = imaging_api.create_cropped_image(crop_request)
Python API를 통한 TIFF 프레임 작업
Python용 Aspose.Imaging Cloud SDK에는 Python 애플리케이션 내에서 TIFF(Tagged Image File Format) 이미지에 대한 매우 강력한 지원이 포함되어 있습니다. 라이브러리에는 다중 프레임 TIFF 이미지에서 프레임 추출, TIFF 프레임 속성 가져오기, TIFF 프레임 크기 조정, TIFF 프레임 회전 또는 뒤집기 지원, TIFF 프레임 자르기, 다른 TIFF 이미지에 TIFF 프레임 추가, 추가 처리를 위한 개별 TIFF 프레임 추출 등 TIFF 파일 형식을 처리하기 위한 여러 가지 중요한 기능이 있습니다.
클라우드 앱에서 고급 이미지 검색
Aspose.Imaging Cloud SDK for Python에는 Python 클라우드 애플리케이션 내에서 다양한 방식으로 이미지를 검색하기 위한 매우 강력한 지원이 포함되어 있습니다. 이 라이브러리를 사용하면 소프트웨어 개발자가 역방향 이미지 검색을 수행할 수 있습니다. 즉, 소스 이미지 세트에 하나 이상의 이미지가 포함되어 있고 이를 여러 다른 이미지와 비교합니다. 소프트웨어 개발자는 두 이미지를 비교하고, 검색 컨텍스트에서 이미지를 가져오고, 검색 컨텍스트에서 이미지 기능을 업데이트하고, 유사한 이미지를 찾고, 중복 이미지를 찾고, 태그로 이미지를 검색하는 등의 작업을 수행할 수 있습니다.
Python API를 통해 중복된 이미지를 찾는 방법?
# optional parameters are base URL, API version and debug mode
imaging_api = ImagingApi('yourClientSecret', 'yourClientId')
# create search context or use existing search context ID if search context was
# created earlier
api_response = imaging_api.create_image_search(CreateImageSearchRequest())
search_context_id = api_response.id
# extract images features if it was not done before
imaging_api.create_image_features(CreateImageFeaturesRequest(
search_context_id, image_id=None, images_folder='WorkFolder'))
# wait 'till image features extraction is completed
while imaging_api.get_image_search_status(
GetImageSearchStatusRequest(
search_context_id)).search_status != 'Idle':
time.sleep(10)
# request finding duplicates
response = imaging_api.find_image_duplicates(
FindImageDuplicatesRequest(search_context_id, 90))
# process duplicates search result
for duplicates in response.duplicates:
print('Duplicates:')
for duplicate in duplicates.duplicate_images:
print('ImageName: {0}, Similarity: {1}'.format(duplicate.image_id,
duplicate.similarity))