Skip to main content

pypixel

Code Quality 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.

Metadata

Release files for pypixelai 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pypixelai 0.2.1
File Size Uploaded
pypixelai-0.2.1.tar.gz 10.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pypixelai 0.2.1
File Interpreter ABI Platform
pypixelai-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 23.9 kB

Release files / pypixelai-0.2.1.tar.gz

Download URL pypixelai-0.2.1.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6c704d8efaccaaea243a09cc0f3308056f20ce1100e80d2a07e10ec7e4253e2b
BLAKE2b-256 checksum
How to use checksums
135bf91ed011da148f8eebc00e19bae4b2dcb312cb98cb6bd9ebb844e48eba51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Release files / pypixelai-0.2.1-py3-none-any.whl

Download URL pypixelai-0.2.1-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
590ca791cc907c6876ab29aec415e4f7106762d475d04db0cd80c952236fc4f0
BLAKE2b-256 checksum
How to use checksums
2df0717819e99b1eec8e04c9cf10ca1fbba4dcec3be4f3331f2980294550afe5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page