元道相机怎么随意改经纬度,元道经纬相机怎么设置转换经纬度

首页 > 机动车 > 作者:YD1662024-01-28 15:38:23

元道经纬相机是一款时间和地点信息真实的专业的现场拍照水印相机,元道经纬相机由深圳市元道通信技术有限公司自主设计研发,现场拍照片或拍视频实时GPS定位,自动加载经纬度、时间、地址,海拔、天气、IMEI、logo等水印信息,可用于巡检维修、项目管理、现场取证、考勤打卡、拍照留痕等不同工作场景,帮助用户轻松记录工作,高效进行团队管理。

元道相机怎么随意改经纬度,元道经纬相机怎么设置转换经纬度(1)

作为python爱好者,当然不能错过这样好的模仿学习机会,今天就尝试模拟出原道相机的水印效果。(仅供学习使用,切勿用作非法用途,否则后果自负)

元道相机怎么随意改经纬度,元道经纬相机怎么设置转换经纬度(2)

以下是实现代码

from PIL import Image, ImageDraw, ImageFont def add_text_to_image(image, text, position, font_size=12, text_color=(255, 255, 255)): font = ImageFont.truetype("simsun.ttc", font_size) draw = ImageDraw.Draw(image) draw.text(position, text, font=font, fill=text_color) def add_hollow_watermark_to_image(image, text, font_size=36, outline_color=(0, 0, 0), outline_width=1): watermark_font = ImageFont.truetype("STCAIYUN.TTF", font_size) # 使用华文彩云字体 text_width, text_height = watermark_font.getsize(text) # Create a new image with transparent background watermark_image = Image.new("RGBA", (text_width 2 * outline_width, text_height 2 * outline_width), (0, 0, 0, 0)) draw = ImageDraw.Draw(watermark_image) # Draw the outline for x_offset in range(-outline_width, outline_width 1): for y_offset in range(-outline_width, outline_width 1): draw.text((outline_width x_offset, outline_width y_offset), text, font=watermark_font, fill=outline_color) return watermark_image def main(): image_path = "C:\\Users\\李武第\\Desktop\\3.png" latitude = "xxx" longitude = "xxx" address = "xxx" timestamp = "xxx" altitude = "xxx米" weather = "xxx" note = "xxx" image = Image.open(image_path) # Add text information to the image text_info = f"经度:{longitude}\n纬度:{latitude}\n地址:{address}\n时间:{timestamp}\n海拔:{altitude}\n天气:{weather}\n备注:{note}" text_position = (40, image.height - 180) # Adjusted position with some padding add_text_to_image(image, text_info, text_position) # Add hollow watermark to the center of the image watermark_text = "现场拍照" watermark_image = add_hollow_watermark_to_image(image, watermark_text, outline_color=(0, 0, 0), outline_width=0) # 调整为更细的边框 watermark_position = ((image.width - watermark_image.width) // 2, (image.height - watermark_image.height) // 2) image.paste(watermark_image, watermark_position, watermark_image) image.save("output_image.png") image.show() if __name__ == "__main__": main()

元道相机怎么随意改经纬度,元道经纬相机怎么设置转换经纬度(3)

之后我会在我的python包PaperCrawlerUtil中加入更加便捷详细的水印功能,敬请关注。

栏目热文

文档排行

本站推荐

Copyright © 2018 - 2021 www.yd166.com., All Rights Reserved.