Skip to main content

Image processing made easy

Project description

pypixel

Code Quality Code coverage Tests License

Pypixel is an NLP-powered code generation tool for image processing. With Pypixel, you can generate Python code snippets for a wide range of image processing tasks, such as applying filters, performing transformations, extracting features, and more. Harness the power of natural language prompts to automate image processing workflows effortlessly. Additionally, Pypixel enables you to generate new images from scratch and edit existing ones, allowing for creative experimentation and customization.

Table of Contents

Features

  • Natural language code generation: Generate Python code snippets for image processing tasks using natural language prompts.
  • Image generation: Generate new images from scratch using natural language prompts.
  • Image editing: Edit existing images using natural language prompts.
  • Image processing: Perform a wide range of image processing tasks, such as applying filters, performing transformations, extracting features, and more.
  • Flexible APIs: Use Pypixel's APIs to integrate image processing into your own applications.

Installation

pip install pypixelai
vim .env # add your API key to the .env file . \

OPENAI_KEY="" 
COHERE_KEY=""
STARCODER_KEY="

Examples

  • Generate code snippets for image processing tasks
    from pypixelai import PyPixel # Import PyPixel
    from pypixelai.models import OpenAI # choose a model
    model = OpenAI()
    px = PyPixel(
          model
          #  debug=True       # print debug messages, default: False
          # retries=3        # number of times to retry code default=1
      )
    code = px(
          "Increase the brightness of the image by 50%",
          #  write_to_file="test_output.py",    # write code to file
          #  run_code=True,                     # run code
      )
      print(code)
    

Output:

import cv2
import numpy as np

img = cv2.imread('image.jpg')
img = np.int16(img)
img = img + (50/100)*img
img = np.clip(img, 0, 255)
img = np.uint8(img)
cv2.imwrite('image_brightened.jpg', img)
  • Generate new images from scratch

      model = OpenAI()  # choose a model
      px = PyPixel(model, retries=3)  # initialize PyPixel with the model
      urls = px.generate_images("Blank white image", num_images=2, download=True)
      print(urls)
    
  • Edit existing images

      image = open("image.jpg", "rb")
      mask = open("mask.png", "rb")
      prompt = "A sunlit indoor lounge area with a pool containing a flamingo"
      urls = px.edit_images(image, mask, prompt, n=None, size=None, download=False)
      print(urls)
    

Contributing

If you have any suggestions or would like to contribute in any way, please raise an issue.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypixelai-0.2.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

pypixelai-0.2.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file pypixelai-0.2.0.tar.gz.

File metadata

  • Download URL: pypixelai-0.2.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for pypixelai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b4a110969838f7efed96d6f61bbe345fcac811a6ed94cb980e0eb7491ebb5aac
MD5 d4164d2f94591e6f7c8f030a211247fd
BLAKE2b-256 4a7d96cdf07174505ec7d40dd11fd0f623cd74eaf7fa300ba71177298f522ed5

See more details on using hashes here.

File details

Details for the file pypixelai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pypixelai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for pypixelai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbe065bd6d2064e70a22c8729d8d23620ff0efd165490782f22852e0696ba9b1
MD5 4a8ad9e3fcd9d64083eae60571a25d72
BLAKE2b-256 3583ad3d3ba7210c2ac15cd07c2da89f6e0fbf45d5de1065a4f39a153536e224

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page