Create Stunning Custom Images with Tnf Only Logo Actions

25 Apr 2025
Create Stunning Custom Images with Tnf Only Logo Actions

The "Tnf Only Logo" service provides developers with powerful Cognitive Actions focused on generating customized images through advanced inpainting techniques. With the ability to create tailored visuals quickly and efficiently, this service helps streamline workflows and enhances creative projects. Whether you are designing marketing materials, personalizing products, or developing content for social media, the Tnf Only Logo actions can significantly simplify the image creation process.

Imagine a scenario where you need to add a logo to a product image or replace a specific area of an image while maintaining the overall aesthetic. This service caters to such needs by allowing developers to specify prompts, aspect ratios, and even utilize advanced features like LoRA (Low-Rank Adaptation) weights. By leveraging these capabilities, you can produce high-quality images that align perfectly with your vision, saving time and resources in the process.

Generate Customized Image with Inpainting

The "Generate Customized Image with Inpainting" action is designed to create tailored images using sophisticated inpainting techniques. This action addresses the challenge of generating images that meet specific visual requirements while ensuring high quality and adherence to user-defined parameters.

Input Requirements: To use this action, you need to provide a prompt that describes the desired outcome. Additional inputs may include:

  • Mask: A URI pointing to an image mask for inpainting.
  • Image: A URI for the input image to be modified.
  • Model: Choose between different models for inference.
  • Aspect Ratio, Width, Height: Define the image dimensions.
  • Lora Scale: Adjust the intensity of LoRA application.
  • Guidance Scale: Set the level of guidance for the diffusion process.
  • Number of Outputs: Specify how many images to generate.

Expected Output: The output will be a customized image based on your specifications, delivered in the chosen format with the defined quality settings. An example output URI will look like:

  • https://assets.cognitiveactions.com/invocations/2ae2c662-e9cb-4bb9-be11-ed452b8cf530/19695a26-c2a0-4985-bbb3-4bb843c8878d.webp

Use Cases for this specific action:

  • Brand Customization: Perfect for businesses looking to add their logos to product images or promotional materials.
  • Marketing Campaigns: Quickly generate visuals that align with specific themes or messages for advertising.
  • Content Creation: Enhance social media posts or blog entries with unique, tailored images that stand out.
  • Prototyping: Create mock-ups for client presentations or design iterations without needing extensive design skills.
import requests
import json

# Replace with your actual Cognitive Actions API key and endpoint
# Ensure your environment securely handles the API key
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
# This endpoint URL is hypothetical and should be documented for users
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"

action_id = "4506153e-9291-42ec-9df1-09d5e5f16863" # Action ID for: Generate Customized Image with Inpainting

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "mask": "https://replicate.delivery/pbxt/Lu4HMxg2hZKW0y5UwWPNr9YXicijuaCnM5SVTiylzSS2ZAnw/mask4.png",
  "image": "https://replicate.delivery/pbxt/Lu4HNylCwulYKr6UvEtzyAYdxpkQ6zdm2HW6xtEcEYHmCiSc/prompt_2_image_2.webp",
  "model": "dev",
  "prompt": "Add the TNF_LOGO in white letters on the black backpack, so THE NORTH FACE text of the logo",
  "loraScale": 1,
  "aspectRatio": "1:1",
  "guidanceScale": 6.89,
  "promptStrength": 0.25,
  "numberOfOutputs": 1,
  "imageOutputFormat": "webp",
  "imageOutputQuality": 90,
  "additionalLoraScale": 1,
  "numberOfInferenceSteps": 28
}

headers = {
    "Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
    "Content-Type": "application/json",
    # Add any other required headers for the Cognitive Actions API
}

# Prepare the request body for the hypothetical execution endpoint
request_body = {
    "action_id": action_id,
    "inputs": payload
}

print(f"--- Calling Cognitive Action: {action.name or action_id} ---")
print(f"Endpoint: {COGNITIVE_ACTIONS_EXECUTE_URL}")
print(f"Action ID: {action_id}")
print("Payload being sent:")
print(json.dumps(request_body, indent=2))
print("------------------------------------------------")

try:
    response = requests.post(
        COGNITIVE_ACTIONS_EXECUTE_URL,
        headers=headers,
        json=request_body
    )
    response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)

    result = response.json()
    print("Action executed successfully. Result:")
    print(json.dumps(result, indent=2))

except requests.exceptions.RequestException as e:
    print(f"Error executing action {action_id}: {e}")
    if e.response is not None:
        print(f"Response status: {e.response.status_code}")
        try:
            print(f"Response body: {e.response.json()}")
        except json.JSONDecodeError:
            print(f"Response body (non-JSON): {e.response.text}")
    print("------------------------------------------------")

Conclusion

The Tnf Only Logo actions empower developers to create customized images with ease and efficiency. By harnessing advanced inpainting techniques, this service enables a wide range of applications from branding to content creation. Whether you're enhancing product visuals or developing unique marketing materials, the flexibility and speed offered by these Cognitive Actions make them an invaluable tool for any developer. To get started, ensure you have your Cognitive Actions API key and familiarize yourself with the API call structure to unlock the full potential of image generation in your projects.