アプリ関連ニュース

MetaQuestアプリの作成を簡単にするBuilding Blocks

Metaが提供している Unity 向けのQuestシリーズ用SDKに含まれるBuilding Blocksを使うと
簡単にQuest用アプリケーションを作成可能です。

続きを読む

Sora from OpenAI

OpenAI has introduced Sora, an innovative generative AI model designed to transform text into video content. According to OpenAI, Sora can produce 1080p movie-like scenes featuring multiple characters, various types of motion, and detailed background elements, based on either brief or detailed text descriptions or still images. Additionally, Sora has the capability to “extend” existing video clips by filling in missing details.

The model’s proficiency lies in its deep understanding of language, enabling it to interpret prompts accurately and generate dynamic characters that convey vivid emotions. OpenAI emphasizes Sora’s comprehension not only of the user’s requests but also of how those elements manifest in the physical world.

Video Credit : OpenAI

Despite the lofty claims made by OpenAI, the showcased samples from Sora demonstrate impressive capabilities compared to other text-to-video technologies. Sora can produce videos up to a minute long in various styles, such as photorealistic, animated, or black and white, maintaining coherence and avoiding common pitfalls associated with AI-generated content.

However, Sora is not without flaws, as acknowledged by OpenAI. The model may struggle with accurately simulating complex scenes’ physics, understanding cause and effect relationships, or maintaining spatial and temporal consistency. OpenAI positions Sora as a research preview, refraining from making it generally available due to concerns about potential misuse.

OpenAI is actively collaborating with experts to identify and address potential vulnerabilities in the model and is developing tools to detect videos generated by Sora. Should OpenAI decide to make Sora publicly accessible, it pledges to include provenance metadata in generated outputs to mitigate misuse risks.

Yuuma



Adding Watermarks to PDFs in Python with simple and efficient approach

In today’s digital age, the need to protect and personalize PDF documents is more crucial than ever. Whether you want to brand your documents or add a confidential watermark, Python provides a powerful and straightforward solution. In this blog, we’ll explore a simple Python script that utilizes the PyPDF2 and ReportLab libraries to effortlessly add watermarks to multiple PDF files.

Setting Up the Environment

Before diving into the script, make sure you have the required libraries installed. You can do this by running the following commands.

pip install PyPDF2
pip install reportlab

Understanding the Script

The entire script can be seen at the end. Let’s break down the key components of the script.

1. create_watermark() Function

   – This function uses the ReportLab library to generate a PDF containing a customizable watermark.

   – You can specify the watermark text, color, transparency, font, and rotation angle.

2. add_watermark() Function

   – The core function that adds the watermark to each page of the input PDF.

   – It uses PyPDF2 to merge the original PDF with the watermark PDF on each page.

3. delete_watermark_file() Function

   – A utility function to delete the temporary watermark PDF file after it has been merged with the input files.

4. Command Line Arguments

   – The script accepts two command line arguments:

     – `–path`: The path to the directory containing the PDF files to watermark.

     – `–watermark_text`: The text to be used as the watermark.

Here is the entire script.

import PyPDF2
import argparse
from reportlab.pdfgen import canvas
from reportlab.lib.units import inch
from reportlab.lib import colors
import os

def create_watermark(watermark_text, output_pdf):
    pdf = canvas.Canvas(output_pdf)
    pdf.translate(inch, inch) # move the current origin point(0,0) of the canvas by the current given horizontal and vertical distances
    pdf.setFillColor(colors.red, alpha=0.3) # set the font color with alpha value to adjust the transparency of watermark text
    pdf.setFont("Helvetica", 50) # set font and font size
    pdf.rotate(45) # rotate the canvas by 45 degrees
    pdf.drawCentredString(400, 100, watermark_text) # center the watermark text
    pdf.save()

def add_watermark(input_pdf, output_directory, watermark_pdf):
    base_filename = os.path.splitext(os.path.basename(input_pdf))[0]
    output_pdf = os.path.join(output_directory, f'{base_filename}.pdf')
    with open(input_pdf, 'rb') as file:
        pdf_reader = PyPDF2.PdfReader(file)
        pdf_writer = PyPDF2.PdfWriter()

        for page_num in range(len(pdf_reader.pages)):
            page = pdf_reader.pages[page_num]
            watermark_reader = PyPDF2.PdfReader(watermark_pdf)
            watermark_page = watermark_reader.pages[0]
            page.merge_page(watermark_page)
            pdf_writer.add_page(page)

        with open(output_pdf, 'wb') as output_file:
            pdf_writer.write(output_file)

def delete_watermark_file(watermark_pdf):
    if os.path.exists(watermark_pdf):
        os.remove(watermark_pdf)
        
if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument("--path", required=True, type=str, help="Path of the directory of file lists")
    parser.add_argument("--watermark_text", required=True, type=str, help="Text to be watermark")
    
    args = parser.parse_args()

    path = args.path
    watermark_text = args.watermark_text
    
    print('Processing.....')
    file_list = [file_name for file_name in os.listdir(path) if os.path.isfile(os.path.join(path, file_name))]

    output_directory = os.path.join(path, 'output_directory')
    if not os.path.exists(output_directory):
        os.makedirs(output_directory)
            
    watermark_pdf_file = os.path.join(path, 'watermark.pdf')
    create_watermark(watermark_text, watermark_pdf_file)
    for file_name in file_list:
        if not file_name == 'watermark.pdf':
            input_pdf_file = os.path.join(path, file_name)
            add_watermark(input_pdf_file, output_directory, watermark_pdf_file)
            
    delete_watermark_file(watermark_pdf_file)
    print('Done!')

Running the Script

To run the script, execute the following command.

python script_name.py --path /path/to/pdf/files --watermark_text "Your Watermark Text"

The script will process each PDF file in the specified directory, add the watermark, and save the watermarked files in a newly created ‘output_directory.’

Conclusion

With this Python script, you can easily add watermarks to your PDF documents, making them visually distinctive and secure. Whether you’re protecting sensitive information or branding your documents, this solution provides a quick and efficient way to enhance your PDF files. I would recommend to look into the used libraries in details and feel free to customize the script further to suit your specific requirements, such as adjusting colors, fonts, or rotation angles for the watermark.

Ref: https://pypdf2.readthedocs.io/en/3.0.0/index.html

Ref: https://docs.reportlab.com

Asahi



Google Map with Generative AI feature

Google Maps is set to revolutionize the way users discover new places with the introduction of a generative AI feature, as announced by the company. Leveraging large language models (LLMs), the feature analyzes a vast database of over 250 million locations on Google Maps and taps into contributions from over 300 million Local Guides. By employing a more conversational approach, users can make nuanced queries, such as seeking “places with a vintage vibe in SF,” and Maps will generate tailored recommendations for thrift shops, complete with categories, photo carousels, and review summaries.

Image Credit : Google

Designed to be intuitive, the generative AI feature goes beyond conventional search experiences. Users can engage in a more dynamic interaction by asking follow-up questions. For example, if the initial query relates to vintage shops and is followed by “How about lunch?” the AI will seamlessly transition to finding restaurants that align with the user’s preferences, creating a more personalized and fluid exploration experience.

Image Credit : google

Google emphasizes the inclusivity of the new feature, asserting its capability to generate recommendations for even the most niche or specific queries. Initially launching as an early access experiment in the U.S., the feature will be accessible to select Local Guides—Google’s community contributors—before extending to a wider user base in the near future. While the company hasn’t disclosed the countries that will receive the feature, the move aligns with Google Maps’ evolving role from a navigation tool to a comprehensive platform for discovering and exploring new places.

This generative AI feature follows Google’s recent updates to Maps, which transformed the platform into a more sophisticated search tool, incorporating AI-powered features like photo results and suggesting specific places in response to ambiguous queries. Google envisions this innovation as just the starting point, expressing its commitment to further enhancing Maps with generative AI, solidifying its position as a go-to destination for exploration and discovery.



[VR] VIVE Eye Tracking SDK のセットアップ方法

今回はUnity VRの開発環境で、VIVE Eye Tracking SDK のセットアップをおこなう方法について紹介します。
以下の手順をおこなうことによりHTC VIVE Pro Eyeのアイトラッキング機能のセットアップおよび開発環境の構築をおこなうことが可能になります。

続きを読む

アプリ関連ニュース

お問い合わせはこちら

お問い合わせ・ご相談はお電話、またはお問い合わせフォームよりお受け付けいたしております。

tel. 06-6454-8833(平日 10:00~17:00)

お問い合わせフォーム