Skip to main content

๐Ÿ–ผ๏ธ Image Module Guide

The Image module provides 9 functions covering compression, conversion, effects, and recognition โ€” everything you need for image processing.

Core Scenariosโ€‹

Image Compressionโ€‹

import office
office.image.compress_image(
input_file='./original_large.jpg',
output_file='./compressed.jpg',
quality=85
)

Batch Watermarkโ€‹

office.image.add_watermark(
file='./photo.jpg',
mark='@python-office',
color='#eaeaea',
size=30,
opacity=0.35,
angle=30
)

Image to Cartoonโ€‹

office.image.img2Cartoon(path='./photo.jpg')

Generate Word Cloudโ€‹

office.image.txt2wordcloud(
filename='./article.txt',
color='white',
result_file='./wordcloud.png'
)

Decode QR Codeโ€‹

result = office.image.decode_qrcode(qrcode_path='./qr.png')
print(result)

Download Imageโ€‹

office.image.down4img(
url='https://example.com/image.jpg',
output_path='./images/',
output_name='downloaded_photo',
type='jpg'
)

Pencil Sketch Effectโ€‹

office.image.pencil4img(
input_img='./photo.jpg',
output_path='./art/',
output_name='pencil_sketch.jpg'
)

Image to GIF / Remove Watermarkโ€‹

office.image.image2gif()
office.image.del_watermark(input_image='./watermarked.jpg', output_image='./no_watermark.jpg')

Full API see Image API Reference

AI ๅŠžๅ…ฌๆ•ˆ็އ่ฏพ
35 ่ฎฒ AI ่‡ชๅŠจๅŒ–ๅŠžๅ…ฌๅฎžๆˆ˜่ฏพ็”จ Python + AI ๅค„็† Excelใ€Wordใ€PDFใ€้‚ฎไปถ็ญ‰ๅŠžๅ…ฌๅœบๆ™ฏใ€‚
ๅŽปๅญฆไน