当前位置: 首页 > news >正文

网站开发属于哪个税收分类正在直播足球比赛

网站开发属于哪个税收分类,正在直播足球比赛,网页开发制作,奥联网络网站建设原图#xff1a; 添加边框后#xff1a; 添加边框会读取照片的exif信息如时间、相机型号、品牌以及快门焦段等信息#xff0c;将他们显示在下面的边框中。 获取当前py文件路径 import os #get path that py file located def Get_Currentpath():file_path os.path.abspa…原图 添加边框后 添加边框会读取照片的exif信息如时间、相机型号、品牌以及快门焦段等信息将他们显示在下面的边框中。 获取当前py文件路径 import os #get path that py file located def Get_Currentpath():file_path os.path.abspath(__file__)dir_path os.path.dirname(file_path)return dir_path弹窗获取所选择文件路径 如下图使用tkinter库掉出弹窗选择指定图片并获取所选择图片的绝对路径 import tkinter #get file path that choosed def Get_FilePath():root tkinter.Tk()root.withdraw()f_path filedialog.askopenfilename()return f_path弹窗获取用户所选择的保存路径 将处理后的图片存储到所选的路径并指定文件名 def save_filePath():# 创建文件对话框root tkinter.Tk()root.withdraw()# 弹出保存文件对话框file_path filedialog.asksaveasfilename(defaultextension.jpg, filetypes[(JPG File, *.jpg), (PNG file,*.png),(All Files, *.*)])print(file_path)# 如果用户选择了文件路径则返回路径if file_path:return file_pathelse:pass创建文字图片 def createfond(size160,str ,color(0,0,0)):lopath Get_Currentpath()fondpath lopathr\material\方正楷体简体.TTFdignum0alphanum0othernum0for i in str:if i.isdigit():dignum1elif i.isalpha():alphanum1else:othernum1在这里插入代码片othernum len(str)-dignumxint(dignum*size*0.6)int(alphanum*size*0.6)int(othernum*size*0.5)yint(size*1.2)img Image.new(RGBA,(x,y),white)draw ImageDraw.Draw(img)#创建一个绘画对象fnt ImageFont.truetype(fondpath,size)draw.text((0,0),str,fillcolor,fontfnt)#img.show()return img,x,y获取字体ttf文件路径 fondpath lopathr\material\方正楷体简体.TTF计算文字所占用的空间大小从而生成合适大小的image图像 xint(dignum*size*0.6)int(alphanum*size*0.6)int(othernum*size*0.5)yint(size*1.2)img Image.new(RGBA,(x,y),white)使用imageDraw 和 ImageFont方法在image图像上写文本 from PIL import Image from PIL import ImageFont from PIL import ImageDraw draw ImageDraw.Draw(img)#创建一个绘画对象 fnt ImageFont.truetype(fondpath,size) draw.text((0,0),str,fillcolor,fontfnt)生成文字图片如下 最后返回的是处理好的文本图像变量和图像的长和高 return img,x,y创建边框 #creat the border def CreateBorder(logopath,color (255,255,255)):Src_path Get_FilePath()pictype picturetype.picturesize.size_16_9img Image.open(Src_path)#get exif dataexif_dict piexif.load(Src_path)exif_bytes piexif.dump(exif_dict)exif_mes img._getexif()# 获取时间信息if Exif in exif_dict:exif_data exif_dict[Exif]#拍摄日期if piexif.ExifIFD.DateTimeOriginal in exif_data:datetime_original_0 str(exif_data[piexif.ExifIFD.DateTimeOriginal].decode(utf-8))#print(DateTimeOriginal:, datetime_original)datetime_original datetime_original_0.replace(:,.,2)datetime_original datetime_original[0:10]print(datetime_original)else: datetime_original #焦距if piexif.ExifIFD.FocalLength in exif_data:FocalLength str(int(exif_data[piexif.ExifIFD.FocalLength][0]/100))mm#print(focal length:,FocalLength)else:FocalLength #ISOif piexif.ExifIFD.ISOSpeedRatings in exif_data:ISO ISOstr(exif_data[piexif.ExifIFD.ISOSpeedRatings])#print(ISO,ISO)else:ISO #快门时间if piexif.ExifIFD.ExposureTime in exif_data:exposure_time exif_data[piexif.ExifIFD.ExposureTime]shutter_speed exposure_time[0] / exposure_time[1]shutter_speed int(1/shutter_speed)shutter_speed 1/str(shutter_speed)selse:shutter_speed #光圈if piexif.ExifIFD.FNumber in exif_data:f_number exif_data[piexif.ExifIFD.FNumber]fnumber f/str(int(f_number[0] / f_number[1]))#print(光圈,fnumber)else:fnumber #镜头品牌if piexif.ExifIFD.LensMake in exif_data:lensmaker exif_data[piexif.ExifIFD.LensMake].decode(utf-8)#print(镜头品牌,lensmaker)else:lensmaker #镜头型号if piexif.ExifIFD.LensModel in exif_data:lensmodel exif_data[piexif.ExifIFD.LensModel].decode(utf-8)#print(镜头型号,lensmodel)else:lensmodel camera_model str(exif_dict[0th].get(piexif.ImageIFD.Model).decode(utf-8))camera_make str(exif_dict[0th].get(piexif.ImageIFD.Make).decode(utf-8))print(camera_make,camera_model)signature Photo by mohuijunelse:pass#get width and highPicWidth img.size[0]PicHigh img.size[1]#picture is 16:9if int(PicWidth/16)int(PicHigh/9):pictype picturetype.picturesize.size_16_9lowwidth int(PicWidth/3*2-PicHigh)Highwidth 0letfWidth 0rightwidth 0borderhigh lowwidthborderwide PicWidthlogoimg Image.open(logopath)logowidth int(PicWidth/7)logohigh int(logowidth/4.3)logoimg.thumbnail((logowidth,logohigh))#create new picNewPicWidth PicWidth letfWidth rightwidthNewPicHigh PicHigh Highwidth lowwidth#logo locationlogo_x int(borderwide/20*11)logo_y int((borderhigh-logohigh)/2)PicHigh#create new pictureimg_new Image.new(RGB, (NewPicWidth, NewPicHigh), color)#create exif messageimg_focallength,focallengthwid,focallengthhigh createfond(size120,strFocalLength)img_data,datawid,datahigh createfond(size90,strsignature on datetime_original,color(120,120,120))img_ISO,ISOwid,ISOhigh createfond(size120,strISO)img_shuttime,shutwid,shuthigh createfond(size120,strshutter_speed)img_FNnumber,FNnumberwid,FNnumberhigh createfond(size120,strfnumber)img_Lens,lenwid,lenhigh createfond(size90,str(lensmaker·lensmodel),color(120,120,120))# create |img_symbal,symbalwid,symbalhigh createfond(size350,str|,color(180,180,180))#create camera modeimg_camera,camerawid,camerahigh createfond(150,str camera_make camera_model)#create signature#img_signature,signaturewid,signaturehigh createfond(size 100,str signature,color(120,120,120))symbal_x logo_xlogowidthsymbal_y int((borderhigh-symbalhigh)/2)PicHigh#exif message locationfocallength_x symbal_xsymbalwidfocallength_y symbal_yint(symbalhigh/10)FNnumber_x focallength_xfocallengthwidFNnumber_y symbal_yint(symbalhigh/10)shuttime_x FNnumber_xFNnumberwidshuttime_y symbal_yint(symbalhigh/10)ISO_x shuttime_xshutwidISO_y symbal_yint(symbalhigh/10)data_x focallength_xdata_y symbal_yint(symbalhigh/3*2)Lens_x 100Lens_y symbal_yint(symbalhigh/3*2)camera_x 100camera_y symbal_yint(symbalhigh/5)img_new.paste(img, (letfWidth, Highwidth))#paste logoimg_new.paste(logoimg,(logo_x,logo_y))#paste exif messageimg_new.paste(img_focallength,(focallength_x,focallength_y))#img_new.paste(img_data,(data_x,data_y))img_new.paste(img_FNnumber,(FNnumber_x,FNnumber_y))img_new.paste(img_ISO,(ISO_x,ISO_y))img_new.paste(img_shuttime,(shuttime_x,shuttime_y))img_new.paste(img_Lens,(Lens_x,Lens_y))img_new.paste(img_data,(data_x,data_y))img_new.paste(img_symbal,(symbal_x,symbal_y))img_new.paste(img_camera,(camera_x,camera_y))Des_path save_filePath()try:img_new.save(Des_path,exifexif_bytes)except:print(地址无效)获取所选图像绝对路径并打开 Src_path Get_FilePath()pictype picturetype.picturesize.size_16_9img Image.open(Src_path)使用piexif库获取图片的exif信息得到拍摄时间、相机型号、光圈、快门等数据信息 import piexif#get exif data exif_dict piexif.load(Src_path) exif_bytes piexif.dump(exif_dict) exif_mes img._getexif() # 获取时间信息 if Exif in exif_dict:exif_data exif_dict[Exif]#拍摄日期if piexif.ExifIFD.DateTimeOriginal in exif_data:datetime_original_0 str(exif_data[piexif.ExifIFD.DateTimeOriginal].decode(utf-8))#print(DateTimeOriginal:, datetime_original)datetime_original datetime_original_0.replace(:,.,2)datetime_original datetime_original[0:10]print(datetime_original)else: datetime_original #焦距if piexif.ExifIFD.FocalLength in exif_data:FocalLength str(int(exif_data[piexif.ExifIFD.FocalLength][0]/100))mm#print(focal length:,FocalLength)else:FocalLength #ISOif piexif.ExifIFD.ISOSpeedRatings in exif_data:ISO ISOstr(exif_data[piexif.ExifIFD.ISOSpeedRatings])#print(ISO,ISO)else:ISO #快门时间if piexif.ExifIFD.ExposureTime in exif_data:exposure_time exif_data[piexif.ExifIFD.ExposureTime]shutter_speed exposure_time[0] / exposure_time[1]shutter_speed int(1/shutter_speed)shutter_speed 1/str(shutter_speed)selse:shutter_speed #光圈if piexif.ExifIFD.FNumber in exif_data:f_number exif_data[piexif.ExifIFD.FNumber]fnumber f/str(int(f_number[0] / f_number[1]))#print(光圈,fnumber)else:fnumber #镜头品牌if piexif.ExifIFD.LensMake in exif_data:lensmaker exif_data[piexif.ExifIFD.LensMake].decode(utf-8)#print(镜头品牌,lensmaker)else:lensmaker #镜头型号if piexif.ExifIFD.LensModel in exif_data:lensmodel exif_data[piexif.ExifIFD.LensModel].decode(utf-8)#print(镜头型号,lensmodel)else:lensmodel camera_model str(exif_dict[0th].get(piexif.ImageIFD.Model).decode(utf-8))camera_make str(exif_dict[0th].get(piexif.ImageIFD.Make).decode(utf-8))print(camera_make,camera_model)signature Photo by mohuijun else:pass获取图片的高和宽度计算照片比例如果原图为169则填充边框变成32 #get width and highPicWidth img.size[0]PicHigh img.size[1]#picture is 16:9if int(PicWidth/16)int(PicHigh/9):pictype picturetype.picturesize.size_16_9lowwidth int(PicWidth/3*2-PicHigh)Highwidth 0letfWidth 0rightwidth 0borderhigh lowwidthborderwide PicWidth依据相机品牌logo的路径获取相机品牌logo图像 #get logo piclogoimg Image.open(logopath)logowidth int(PicWidth/7)logohigh int(logowidth/4.3)logoimg.thumbnail((logowidth,logohigh))#create new picNewPicWidth PicWidth letfWidth rightwidthNewPicHigh PicHigh Highwidth lowwidth#logo locationlogo_x int(borderwide/20*11)logo_y int((borderhigh-logohigh)/2)PicHigh创建一个信息图片image作为处理后的图片 #create new pictureimg_new Image.new(RGB, (NewPicWidth, NewPicHigh), color)使用上面所述的创建文字图像方法依次创建相机信息的图像 #create exif messageimg_focallength,focallengthwid,focallengthhigh createfond(size120,strFocalLength)img_data,datawid,datahigh createfond(size90,strsignature on datetime_original,color(120,120,120))img_ISO,ISOwid,ISOhigh createfond(size120,strISO)img_shuttime,shutwid,shuthigh createfond(size120,strshutter_speed)img_FNnumber,FNnumberwid,FNnumberhigh createfond(size120,strfnumber)img_Lens,lenwid,lenhigh createfond(size90,str(lensmaker·lensmodel),color(120,120,120))# create |img_symbal,symbalwid,symbalhigh createfond(size350,str|,color(180,180,180))#create camera modeimg_camera,camerawid,camerahigh createfond(150,str camera_make camera_model)计算文字图像需要摆放的位置 symbal_x logo_xlogowidthsymbal_y int((borderhigh-symbalhigh)/2)PicHigh#exif message locationfocallength_x symbal_xsymbalwidfocallength_y symbal_yint(symbalhigh/10)FNnumber_x focallength_xfocallengthwidFNnumber_y symbal_yint(symbalhigh/10)shuttime_x FNnumber_xFNnumberwidshuttime_y symbal_yint(symbalhigh/10)ISO_x shuttime_xshutwidISO_y symbal_yint(symbalhigh/10)data_x focallength_xdata_y symbal_yint(symbalhigh/3*2)Lens_x 100Lens_y symbal_yint(symbalhigh/3*2)camera_x 100camera_y symbal_yint(symbalhigh/5)效果图下 将所有文字图像和原图按照指定位置和大小复制到新的图像中 #paste orignial pictureimg_new.paste(img, (letfWidth, Highwidth))#paste logoimg_new.paste(logoimg,(logo_x,logo_y))#paste exif messageimg_new.paste(img_focallength,(focallength_x,focallength_y))#img_new.paste(img_data,(data_x,data_y))img_new.paste(img_FNnumber,(FNnumber_x,FNnumber_y))img_new.paste(img_ISO,(ISO_x,ISO_y))img_new.paste(img_shuttime,(shuttime_x,shuttime_y))img_new.paste(img_Lens,(Lens_x,Lens_y))img_new.paste(img_data,(data_x,data_y))img_new.paste(img_symbal,(symbal_x,symbal_y))img_new.paste(img_camera,(camera_x,camera_y))获取保存路径并保存 Des_path save_filePath()try:img_new.save(Des_path,exifexif_bytes)except:print(地址无效)主函数 创建图片边框 Local_path Get_Currentpath() LOGOPATH Local_pathr\material\fujifilmlogo.jpg CreateBorder(logopathLOGOPATH)附全部代码 import tkinter import os from tkinter import filedialog from PIL import Image from PIL import ImageFont from PIL import ImageDraw import exifread import piexif #get path that py file located def Get_Currentpath():file_path os.path.abspath(__file__)dir_path os.path.dirname(file_path)return dir_path #get file path that choosed def Get_FilePath():root tkinter.Tk()root.withdraw()f_path filedialog.askopenfilename()return f_path #set path to save def save_filePath():# 创建文件对话框root tkinter.Tk()root.withdraw()# 弹出保存文件对话框file_path filedialog.asksaveasfilename(defaultextension.jpg, filetypes[(JPG File, *.jpg), (PNG file,*.png),(All Files, *.*)])print(file_path)# 如果用户选择了文件路径则返回路径if file_path:return file_pathelse:pass #create font def createfond(size160,str ,color(0,0,0)):lopath Get_Currentpath()fondpath lopathr\material\方正楷体简体.TTFdignum0alphanum0othernum0for i in str:if i.isdigit():dignum1elif i.isalpha():alphanum1else:othernum1othernum len(str)-dignumxint(dignum*size*0.6)int(alphanum*size*0.6)int(othernum*size*0.5)yint(size*1.2)img Image.new(RGBA,(x,y),white)draw ImageDraw.Draw(img)#创建一个绘画对象fnt ImageFont.truetype(fondpath,size)draw.text((0,0),str,fillcolor,fontfnt)#img.show()return img,x,y #creat the border def CreateBorder(logopath,color (255,255,255)):Src_path Get_FilePath()pictype picturetype.picturesize.size_16_9img Image.open(Src_path)#get exif dataexif_dict piexif.load(Src_path)exif_bytes piexif.dump(exif_dict)exif_mes img._getexif()# if exif_mes is not None:# camera_info exif_mes.get(0x010F) # 0x010F表示相机品牌和型号的标记# print(camera_info)# 获取时间信息if Exif in exif_dict:exif_data exif_dict[Exif]#拍摄日期if piexif.ExifIFD.DateTimeOriginal in exif_data:datetime_original_0 str(exif_data[piexif.ExifIFD.DateTimeOriginal].decode(utf-8))#print(DateTimeOriginal:, datetime_original)datetime_original datetime_original_0.replace(:,.,2)datetime_original datetime_original[0:10]print(datetime_original)else: datetime_original #焦距if piexif.ExifIFD.FocalLength in exif_data:FocalLength str(int(exif_data[piexif.ExifIFD.FocalLength][0]/100))mm#print(focal length:,FocalLength)else:FocalLength #ISOif piexif.ExifIFD.ISOSpeedRatings in exif_data:ISO ISOstr(exif_data[piexif.ExifIFD.ISOSpeedRatings])#print(ISO,ISO)else:ISO #快门时间if piexif.ExifIFD.ExposureTime in exif_data:exposure_time exif_data[piexif.ExifIFD.ExposureTime]shutter_speed exposure_time[0] / exposure_time[1]shutter_speed int(1/shutter_speed)shutter_speed 1/str(shutter_speed)selse:shutter_speed #光圈if piexif.ExifIFD.FNumber in exif_data:f_number exif_data[piexif.ExifIFD.FNumber]fnumber f/str(int(f_number[0] / f_number[1]))#print(光圈,fnumber)else:fnumber #镜头品牌if piexif.ExifIFD.LensMake in exif_data:lensmaker exif_data[piexif.ExifIFD.LensMake].decode(utf-8)#print(镜头品牌,lensmaker)else:lensmaker #镜头型号if piexif.ExifIFD.LensModel in exif_data:lensmodel exif_data[piexif.ExifIFD.LensModel].decode(utf-8)#print(镜头型号,lensmodel)else:lensmodel # if piexif.ExifIFD. in exif_data:# makernote exif_data[piexif.ExifIFD.DeviceSettingDescription].decode(utf-8)# print(相机,makernote)#get camera modecamera_model str(exif_dict[0th].get(piexif.ImageIFD.Model).decode(utf-8))#camera_model camera_model[2:-1]camera_make str(exif_dict[0th].get(piexif.ImageIFD.Make).decode(utf-8))#camera_make camera_make[2:-1]print(camera_make,camera_model)#get camera maker#print(camera:,camera_model)signature Photo by mohuijunelse:pass#get width and highPicWidth img.size[0]PicHigh img.size[1]#picture is 16:9if int(PicWidth/16)int(PicHigh/9):lowwidth int(PicWidth/3*2-PicHigh)Highwidth 0letfWidth 0rightwidth 0borderhigh lowwidthborderwide PicWidth#create border#get logo piclogoimg Image.open(logopath)logowidth int(PicWidth/7)logohigh int(logowidth/4.3)logoimg.thumbnail((logowidth,logohigh))#create new picNewPicWidth PicWidth letfWidth rightwidthNewPicHigh PicHigh Highwidth lowwidth#logo locationlogo_x int(borderwide/20*11)logo_y int((borderhigh-logohigh)/2)PicHigh#create new pictureimg_new Image.new(RGB, (NewPicWidth, NewPicHigh), color)#create exif messageimg_focallength,focallengthwid,focallengthhigh createfond(size120,strFocalLength)img_data,datawid,datahigh createfond(size90,strsignature on datetime_original,color(120,120,120))img_ISO,ISOwid,ISOhigh createfond(size120,strISO)img_shuttime,shutwid,shuthigh createfond(size120,strshutter_speed)img_FNnumber,FNnumberwid,FNnumberhigh createfond(size120,strfnumber)img_Lens,lenwid,lenhigh createfond(size90,str(lensmaker·lensmodel),color(120,120,120))# create |img_symbal,symbalwid,symbalhigh createfond(size350,str|,color(180,180,180))#create camera modeimg_camera,camerawid,camerahigh createfond(150,str camera_make camera_model)#create signature#img_signature,signaturewid,signaturehigh createfond(size 100,str signature,color(120,120,120))symbal_x logo_xlogowidthsymbal_y int((borderhigh-symbalhigh)/2)PicHigh#exif message locationfocallength_x symbal_xsymbalwidfocallength_y symbal_yint(symbalhigh/10)FNnumber_x focallength_xfocallengthwidFNnumber_y symbal_yint(symbalhigh/10)shuttime_x FNnumber_xFNnumberwidshuttime_y symbal_yint(symbalhigh/10)ISO_x shuttime_xshutwidISO_y symbal_yint(symbalhigh/10)data_x focallength_xdata_y symbal_yint(symbalhigh/3*2)Lens_x 100Lens_y symbal_yint(symbalhigh/3*2)# signature_x 100# signature_y Lens_ycamera_x 100camera_y symbal_yint(symbalhigh/5)#paste singnature picture#img_new.paste(img_signature,(signature_x,signature_y))#paste orignial pictureimg_new.paste(img, (letfWidth, Highwidth))#paste logoimg_new.paste(logoimg,(logo_x,logo_y))#paste exif messageimg_new.paste(img_focallength,(focallength_x,focallength_y))#img_new.paste(img_data,(data_x,data_y))img_new.paste(img_FNnumber,(FNnumber_x,FNnumber_y))img_new.paste(img_ISO,(ISO_x,ISO_y))img_new.paste(img_shuttime,(shuttime_x,shuttime_y))img_new.paste(img_Lens,(Lens_x,Lens_y))img_new.paste(img_data,(data_x,data_y))img_new.paste(img_symbal,(symbal_x,symbal_y))img_new.paste(img_camera,(camera_x,camera_y))Des_path save_filePath()try:img_new.save(Des_path,exifexif_bytes)except:print(地址无效)Local_path Get_Currentpath() LOGOPATH Local_pathr\material\fujifilmlogo.jpg CreateBorder(logopathLOGOPATH)
http://www.w-s-a.com/news/678486/

相关文章:

  • 自己做网站需要哪些流程网站建设服务费如何做会计分录
  • 莆田建站培训用手机制作游戏的app软件
  • 中山建网站找哪家wordpress采集图片插件
  • 网站首页做后台链接有什么好用的模拟建站软件
  • 宁波有没有开发网站的公司网站上线除了备案还需要什么
  • 网站备案授权wordpress默认主体设置
  • 厦门微信网站广州推广策划公司
  • 集团公司网站开发asp网站怎么运行
  • 广州短视频网站开发东莞市建设信息网
  • 建设网站如果赚钱电脑可以做服务器部署网站吗
  • 网站建设的编程专门做面包和蛋糕的网站
  • 档案网站建设比较分析南京建站公司
  • 哪个网站可以做店招傻瓜式wordpress
  • 网站开发项目经理职责青岛模版网站建设
  • 企业建站哪个好网站建设所用程序
  • 网站建设seo视频定制图片软件
  • 404错误直接转向到网站首页四川省建筑施工企业人员考试平台
  • 手表电商网站智能展厅
  • 南海网站推广梅州做网站公司
  • 昆明专业网站建设公司成都外贸网站建设费用
  • php mysql网站开发项目公司网站宣传设计
  • 自己做网站服务器的备案方法怎么查网站点击量
  • 信息产业部icp备案中心网站织梦做双语网站
  • 爱站网站长seo综合查询工具局网站信息内容建设 自查报告
  • 我想建一个网站怎么建淄博网站推广那家好
  • 做网站和app需要多久河南自助建站建设代理
  • 大连做企业网站的公司宣传平台有哪些类型
  • 如何用微信做网站免费设计logo网站有哪些
  • 服务平台型网站余姚网站定制
  • 网站搭建联系方式太平阳电脑网网站模板