Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
barseghyanartur committed Oct 17, 2024
2 parents 2cf923f + e240181 commit f281786
Show file tree
Hide file tree
Showing 7 changed files with 430 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
pull_request:
types: [review_requested, ready_for_review]
workflow_dispatch:

jobs:
# *************************************
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ are used for versioning (schema follows below):
0.3.4 to 0.4).
- All backwards incompatible changes are mentioned in this document.

0.10.4
------
2024-10-17

- Add a ``separator`` argument to the ``slugify`` function.
- Minor documentation improvements.

0.10.3
------
2024-10-16

- Add `JPG` file support through ``jpg`` and ``jpg_file`` providers.

0.10.2
------
2024-10-07
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Update version ONLY here
VERSION := 0.11.2
VERSION := 0.10.3
SHELL := /bin/bash
# Makefile for project
VENV := ~/.virtualenvs/fake.py/bin/activate
Expand Down
8 changes: 5 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ types (such as `uuid`, `str`, `int`, `float`, `bool`), GEO data such as city,
country, geo-location, country code, latitude, longitude and locales,
IBANs and ISBNs, as well as byte content for multiple file formats
including `PDF`, `DOCX`, `ODT`, `PNG`, `SVG`, `BMP`, `GIF`, `TIF`, `PPM`,
`WAV`, `ZIP`, `TAR` and `EML`.
`JPG`, `WAV`, `ZIP`, `TAR` and `EML`.

The package also supports file creation on the filesystem and includes
factories (dynamic fixtures) compatible with `Django`_, `TortoiseORM`_,
Expand All @@ -86,8 +86,8 @@ Features
- Generation of random texts, (person) names, emails, URLs, dates, IPs, and
primitive Python data types.
- Support for various file formats (`PDF`, `DOCX`, `ODT`, `TXT`, `PNG`, `SVG`,
`BMP`, `GIF`, `TIF`, `PPM`, `WAV`, `ZIP`, `TAR`, `EML`) and file creation
on the filesystem.
`BMP`, `GIF`, `TIF`, `PPM`, `JPG`, `WAV`, `ZIP`, `TAR`, `EML`) and file
creation on the filesystem.
- Basic factories for integration with `Django`_, `Pydantic`_,
`TortoiseORM`_ and `SQLAlchemy`_.
- `CLI`_ for generating data from command line.
Expand Down Expand Up @@ -267,6 +267,7 @@ As bytes
FAKER.docx() # bytes
FAKER.eml() # bytes
FAKER.gif() # bytes
FAKER.jpg() # bytes
FAKER.odt() # bytes
FAKER.pdf() # bytes
FAKER.png() # bytes
Expand All @@ -288,6 +289,7 @@ As files on the file system
FAKER.docx_file() # str
FAKER.eml_file() # str
FAKER.gif_file() # str
FAKER.jpg_file() # str
FAKER.odt_file() # str
FAKER.pdf_file() # str
FAKER.png_file() # str
Expand Down
50 changes: 48 additions & 2 deletions docs/creating_images.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Currently, 6 image formats are supported:
- ``GIF``
- ``TIF``
- ``PPM``
- ``JPG``

Generating images as bytes
--------------------------
Expand Down Expand Up @@ -81,7 +82,52 @@ With ``size`` and ``color`` tweaks:

----

All other formats (``SVG``, ``BMP``, ``GIF``, ``TIF`` and ``PPM``) work in
exact same way.
All other formats (``SVG``, ``BMP``, ``GIF``, ``TIF``, ``PPM`` and ``JPG``)
work in exact same way.

The only format that slightly deviates from others is ``JPG``. Produced
``JPG`` images are still rectangles, but unlike all others, instead of being
filled with a single solid colour, they are filled with a mixture of colours,
around a picked base colour. Also, colours on the ``JPG`` image are not
precise, but a closest match to the colour given.

The following code will generate a 10x10 px square filled with solid yellow
colour.

.. container:: jsphinx-toggle-emphasis

.. code-block:: python
:name: test_jpg_file_10x10_yellow
:emphasize-lines: 3
from fake import FAKER
FAKER.jpg_file(size=(10, 10), color=(182, 232, 90))
While the following code, will generate a 640x480 px square filled with yellow
and other colours.

.. container:: jsphinx-toggle-emphasis

.. code-block:: python
:name: test_jpg_file_640x480_yellow_mix
:emphasize-lines: 3
from fake import FAKER
FAKER.jpg_file(size=(640, 480), color=(18, 52, 185))
The only colour that always stays solid is the default colour - gray
``(128, 128, 128)``.

.. container:: jsphinx-toggle-emphasis

.. code-block:: python
:name: test_jpg_file_300x200_solid_gray
:emphasize-lines: 3
from fake import FAKER
FAKER.jpg_file(size=(720, 540))
----
Loading

0 comments on commit f281786

Please sign in to comment.