×ðÁú¿­Ê±

ÔõÑùÔÚ÷è÷ë²Ù×÷ϵͳÉϾÙÐÐͼƬºÍÕÕƬµÄ±à¼­ºÍ´¦Öóͷ£ £¿

ÔõÑùÔÚ÷è÷ë²Ù×÷ϵͳÉϾÙÐÐͼƬºÍÕÕƬµÄ±à¼­ºÍ´¦Öóͷ£ £¿

÷è÷ë²Ù×÷ϵͳÊÇÖйú×ÔÖ÷Ñз¢µÄÒ»ÖÖ»ùÓÚLinuxµÄ×ÔÓɲÙ×÷ϵͳ¡£ËüÖ§³Ö¶àÖÖÓ²¼þƽ̨£¬²¢ÌṩÁ˸»ºñµÄ¹¦Ð§ºÍ¹¤¾ß¡£ÆäÖÐÒ»¸öÖ÷ÒªµÄ¹¦Ð§¾ÍÊÇͼƬºÍÕÕƬµÄ±à¼­ºÍ´¦Öóͷ£¡£ÏÂÃ潫ÏÈÈÝÔÚ÷è÷ë²Ù×÷ϵͳÉÏÔõÑù¾ÙÐÐͼƬºÍÕÕƬµÄ±à¼­ºÍ´¦Öóͷ££¬²¢ÌṩÏìÓ¦µÄ´úÂëʾÀý¡£

Ê×ÏÈ£¬ÎÒÃÇÐèҪװÖÃһЩͼÏñ´¦Öóͷ£ºÍ±à¼­µÄ¹¤¾ß¡£ÔÚ÷è÷ë²Ù×÷ϵͳÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃGIMP£¨GNU Image Manipulation Program£©À´¾ÙÐÐͼÏñµÄ±à¼­ºÍ´¦Öóͷ£¡£GIMP ÊÇÒ»¿î¹¦Ð§Ç¿Ê¢¡¢Ãâ·ÑÇÒ¿ªÔ´µÄͼÏñ´¦Öóͷ£Èí¼þ£¬¿ÉÒÔÖª×ãÖÖÖÖͼÏñ´¦Öóͷ£ÐèÇó¡£

ҪװÖÃGIMP£¬·­¿ªÖն˲¢ÊäÈëÒÔÏÂÏÂÁ

sudo apt-get update
sudo apt-get install gimp

µÇ¼ºó¸´ÖÆ

×°ÖÃÍê³Éºó£¬ÎÒÃǾͿÉÒÔʹÓÃGIMP¾ÙÐÐͼÏñµÄ±à¼­ºÍ´¦Öóͷ£ÁË¡£

·­¿ªÍ¼Ïñ

ÔÚGIMPµÄ²Ëµ¥À¸ÖУ¬Ñ¡Ôñ¡°Îļþ¡±->¡°·­¿ª¡±£¬È»ºóÑ¡ÕªÒª±à¼­µÄͼÏñÎļþ¡£GIMPÖ§³Ö¶àÖÖͼÏñÃûÌ㬰üÀ¨JPG¡¢PNG¡¢BMPµÈ¡£

ͼÏñµ÷½â

ÔÚGIMPµÄ¡°¹¤¾ßÏ䡱ÖУ¬Äã¿ÉÒÔÕÒµ½ÖÖÖÖ¹¤¾ßºÍÑ¡ÏîÀ´µ÷½âͼÏñ¡£ÀýÈ磬Äã¿ÉÒÔʹÓá°ÁÁ¶È/±ÈÕնȡ±¹¤¾ßÀ´µ÷½âͼÏñµÄÁÁ¶ÈºÍ±ÈÕնȣ¬Ê¹Óá°É«µ÷/±¥ºÍ¶È¡±¹¤¾ßÀ´µ÷½âͼÏñµÄɫЭµ÷±¥ºÍ¶ÈµÈ¡£

ÒÔÏÂÊÇÒ»¸ö¼òÆӵĴúÂëʾÀý£¬ÑÝʾÔõÑùʹÓÃGIMPÀ´µ÷½âͼÏñµÄÁÁ¶ÈºÍ±ÈÕնȣº

import os
import subprocess

def adjust_image_brightness_contrast(image_path, brightness, contrast):
    try:
        command = f"gimp -i -b '(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE "{image_path}" "{image_path}"))) (drawable (car (gimp-image-get-active-layer image)))) (gimp-image-undo-group-start image) (gimp-levels-stretch drawable 0 {brightness} {contrast}) (gimp-image-undo-group-end image) (gimp-file-save RUN-NONINTERACTIVE image drawable "{image_path}" "{image_path}") (gimp-image-delete image))' -b '(gimp-quit 0)'"
        subprocess.run(command, shell=True, check=True)
        return True
    except subprocess.CalledProcessError:
        return False

image_path = "path/to/your/image.jpg"
brightness = 50
contrast = 25

if adjust_image_brightness_contrast(image_path, brightness, contrast):
    print("Image adjusted successfully.")
else:
    print("Failed to adjust image.")

µÇ¼ºó¸´ÖÆ

¸Ã´úÂëʹÓÃÁËGIMPµÄÏÂÁîÐнӿÚ£¬ÏÈ·­¿ªÖ¸¶¨µÄͼÏñÎļþ£¬È»ºóŲÓÃÁËgimp-levels-stretchº¯ÊýÀ´¾ÙÐÐÁÁ¶ÈºÍ±ÈÕնȵĵ÷½â£¬×îºóÉúÑIJ¢¹Ø±ÕͼÏñ¡£Äã¿ÉÒÔƾ֤ÐèÒª¸ü¸ÄÁÁ¶ÈºÍ±ÈÕնȵÄÖµ¡£

ͼÏñ²Ã¼ôºÍÐýת

GIMPÒ²ÌṩÁ˲üôºÍÐýתͼÏñµÄ¹¦Ð§¡£Äã¿ÉÒÔʹÓᰲüô¡±¹¤¾ßÀ´Ñ¡ÔñͼÏñÖиÐÐËȤµÄÇøÓò£¬²¢¼ô²Ã³öÀ´¡£Ê¹Óá°Ðýת¡±¹¤¾ß¿ÉÒÔ½«Í¼Ïñƾָ֤¶¨µÄ½Ç¶È¾ÙÐÐÐýת¡£

ÒÔÏÂÊÇÒ»¸ö¼òÆӵĴúÂëʾÀý£¬ÑÝʾÔõÑùʹÓÃGIMPÀ´²Ã¼ôºÍÐýתͼÏñ£º

import subprocess

def crop_image(image_path, x, y, width, height):
    try:
        command = f"gimp -i -b '(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE "{image_path}" "{image_path}"))) (drawable (car (gimp-image-get-active-layer image)))) (gimp-image-undo-group-start image) (gimp-image-crop image {width} {height} {x} {y}) (gimp-image-undo-group-end image) (gimp-file-save RUN-NONINTERACTIVE image drawable "{image_path}" "{image_path}") (gimp-image-delete image))' -b '(gimp-quit 0)'"
        subprocess.run(command, shell=True, check=True)
        return True
    except subprocess.CalledProcessError:
        return False

def rotate_image(image_path, angle):
    try:
        command = f"gimp -i -b '(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE "{image_path}" "{image_path}"))) (drawable (car (gimp-image-get-active-layer image)))) (gimp-image-undo-group-start image) (gimp-image-rotate image {angle}) (gimp-image-undo-group-end image) (gimp-file-save RUN-NONINTERACTIVE image drawable "{image_path}" "{image_path}") (gimp-image-delete image))' -b '(gimp-quit 0)'"
        subprocess.run(command, shell=True, check=True)
        return True
    except subprocess.CalledProcessError:
        return False

image_path = "path/to/your/image.jpg"
x = 100
y = 100
width = 200
height = 200
angle = 45

if crop_image(image_path, x, y, width, height):
    print("Image cropped successfully.")
else:
    print("Failed to crop image.")

if rotate_image(image_path, angle):
    print("Image rotated successfully.")
else:
    print("Failed to rotate image.")

µÇ¼ºó¸´ÖÆ

¸Ã´úÂëʹÓÃÁËGIMPµÄÏÂÁîÐнӿÚ£¬ÏÈ·­¿ªÖ¸¶¨µÄͼÏñÎļþ£¬È»ºóŲÓÃÁËgimp-image-cropº¯ÊýÀ´¾ÙÐвüô£¬Å²ÓÃÁËgimp-image-rotateº¯ÊýÀ´¾ÙÐÐÐýת£¬×îºóÉúÑIJ¢¹Ø±ÕͼÏñ¡£Äã¿ÉÒÔƾ֤ÐèÒª¸ü¸Ä²Ã¼ôµÄ×ø±êºÍ³ß´çÒÔ¼°ÐýתµÄ½Ç¶È¡£

ͨ¹ýÒÔÉÏʾÀý£¬ÄãÒѾ­Ñ§»áÁËÔõÑùÔÚ÷è÷ë²Ù×÷ϵͳÉÏʹÓÃGIMP¾ÙÐÐͼƬºÍÕÕƬµÄ±à¼­ºÍ´¦Öóͷ£¡£ÆñÂÛÊǵ÷½âÁÁ¶È±ÈÕնȡ¢²Ã¼ôÕÕ¾ÉÐýת£¬¶¼¿ÉÒÔͨ¹ý¼òÆӵĴúÂëʵÏÖ¡£ÒÔºó£¬Äã¿ÉÒÔΪËùÓûΪµØ±à¼­ºÍ´¦Öóͷ£ÄãµÄͼƬºÍÕÕƬÁË£¡

ÒÔÉϾÍÊÇÔõÑùÔÚ÷è÷ë²Ù×÷ϵͳÉϾÙÐÐͼƬºÍÕÕƬµÄ±à¼­ºÍ´¦Öóͷ£ £¿µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿