0
このコードでファイルパスを変更する方法はわかりませんか?出力ファイルのパスはどのように変更できますか? outfile = join(basename(image))
import os
import glob
import time
import traceback
from time import sleep
import RPi.GPIO as GPIO
import picamera
import atexit
import sys
import socket
import pygame
from pygame.locals import QUIT, KEYDOWN, K_ESCAPE
import pytumblr
import config
from signal import alarm, signal, SIGALRM, SIGKILL
from os.path import join, basename, expanduser
from PIL import Image
def watermark(image):
""" Apply a watermark to an image """
mark = Image.open(watermark_img)
im = Image.open(image)
if im.mode != 'RGBA':
im = im.convert('RGBA')
layer = Image.new('RGBA', im.size, (0,0,0,0))
position = (im.size[0] - mark.size[0], im.size[1] - mark.size[1])
layer.paste(mark, position)
outfile = join(basename(image))
Image.composite(layer, im, layer).save(outfile)
return outfile
私はそれがどちらかに行きたい:/home/pi/photobooth/pics/
または同じ場所であるconfig.file_path
。
は、使用、輸入に関する情報を追加します。 using –
これは役に立ちますか?輸入OS GPIO 輸入picamera#http://picamera.readthedocs.org/en/release-1.4/install2.html インポートのatexitとして時間インポート睡眠 輸入RPi.GPIOから 輸入グロブ インポート時 輸入トレースバック 輸入SYS 輸入ソケットpygame.localsから インポートpygameの インポートQUIT、KEYDOWN、K_ESCAPE PILからの輸入pytumblr信号のインポートアラーム、信号、SIGALRM、SIGKILL はos.pathインポートが参加するから、ベース名から インポート設定 、expanduser イメージをインポートする – theshepherdmatt