Metadata-Version: 2.1
Name: django-webpfield
Version: 0.0.1
Summary: A simple library that convert any user uploaded images to webP format
Project-URL: github, https://github.com/ahmedwelhakim/django-webpfield/
Author-email: Ahmed Elhakim <ahmed.w.elhakim@gmail.com>
License: The MIT License (MIT)
        
        Copyright (c) 2014 WGBH Educational Foundation
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in
        all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
        THE SOFTWARE.
License-File: LICENSE
Keywords: django,webp
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Multimedia :: Graphics :: Presentation
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Requires-Dist: django>=4.2
Requires-Dist: pillow>=9.5.0
Description-Content-Type: text/x-rst

=============================
Welcome to Django WebP Field
=============================

This is a library for Django that provides a custom model field for storing WebP images.
The `WebPField` model field allows you to store WebP images in your Django models
and provides convenient methods for converting between WebP and other image formats.

Installation
------------

To install the library, simply add it to your project's dependencies using pip:

.. code-block:: bash

    pip install django-webpfield

Usage
-----

To use the `WebPField` model field, simply import it from the library and add it to your Django model:

.. code-block:: python

    from django.db import models
    from webpfield.fields import WebPField


    class MyModel(models.Model):
        my_image = WebPField(upload_to="images/")


Settings
--------
The default settings are:

.. code-block:: python

    WEBP_FIELD_SETTINGS = {
        "saving_kwargs": {
            "quality": 75,
            "lossless": False,
        },
        "delete_original": False,
        "enable_svg": True,
        "image_field_class": {"module": "django.db.models", "class_name": "ImageField"},
    }

- saving_kwargs: are the kwargs passed to pillow when saving the new image
- enable_svg: if True you can upload and svg and it will remain svg as original, this achieved by updating the formfield kwargs of WebPField to file field instead of image field
- image_field_class: The default parent class of WebPField is django ImageField, but you can override it with yours

Contributing
------------

Contributions to the library are welcome! If you find a bug, have a feature request, or would like to contribute code,
please open an issue or pull request on the GitHub repo.

License
-------

This library is licensed under the MIT license. See the LICENSE file for more information.
