We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

Convert JPG to SVG in Python throws 404 error

Hello! I’m trying to convert jpg to svg but get an ApiException: “404 Error connecting to the API” (Message: “Not Found”). I simply used your readme example after registering. Here is my code (I also tried to send “ConvertImageRequest” a “storage” name but it didn’t work):
import asposeimagingcloud as im
imaging_api = im.ImagingApi(“my_client_secret”, “my_client_id”)
request = im.ConvertImageRequest("./dog.jpg", “png”)
response = imaging_api.convert_image(request)

@royamb1

To convert JPG to SVG in Python, first please ensure that you signed up successfully with aspose.cloud and get the credentials from your aspose.cloud application. And then test the following code with the latest version of Aspose.Imaging Cloud SDK for Python from PIP. Hopefully, it will help you to accomplish the task.

Convert JPG to PNG in Python from Cloud Storage

import asposeimagingcloud as im

# Get App key and App SID from https://cloud.aspose.com
imaging_api = im.ImagingApi('xxxxxxxxxxxxxxxxxxxxx','xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx')

# convert image from cloud storage to PNG
request = im.models.requests.ConvertImageRequest("Tulips.jpg", "png")
response = imaging_api.convert_image(request)

# save output to the storage
result = imaging_api.upload_file(im.models.requests.UploadFileRequest('resultImage.png', response))
print(result)

Convert JPG to JPG in Python without storage

import asposeimagingcloud as im
from shutil import copyfile

# Get App key and App SID from https://cloud.aspose.com
imaging_api = im.ImagingApi('xxxxxxxxxxxxxxxxxxx','xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx')

# convert image from local drive to JPG

local_input_image = "C:/Temp/test.png"
local_output_image= "C:/Temp/test.jpg"

image_stream = imaging_api.create_converted_image(im.models.requests.CreateConvertedImageRequest(local_input_image, "jpg"))

# save output to the storage
copyfile(image_stream, local_output_image)