download-image

Creates a django image file in the specified format from a remote url.


License
BSD-1-Clause
Install
pip install download-image==1.0.0

Documentation

Download Image

Description

Create an in-memory image file, in the specified format, from a remote URL for saving to a django ImageField.

Installation

pip install download_image

Methods

  1. download_image_as_gif(url, file_name)
  2. download_image_as_png(url, file_name)
  3. download_image_as_jpeg(url, file_name)
  4. download_image_as(url, file_format, file_name)

Usage

from django.db import models
from download_image.utils import download_image_as_gif

class ExampleModel(models.Model):
    picture = models.ImageField(upload_to="/path/to/upload/")

instance = ExampleModel()
instance.picture = download_image_as_gif("https://url.to.file", "optional_file_name.gif")
instance.save()