F-Stop
-
A mini-lang for basic image manipulation written in python
-
Uses rply for lexing / parsing
- Pillow & OpenCV for the processing
Execution
from fstop import Runner
runner = Runner(reset_after_execute=True)
# reset_after_execute indicates to not preserve state after each execution
runner.execute(
'ECHO "hello world"' # hello world program :D
)
Language Examples
(basic)
OPEN 'filename.png' AS img // Opens a local image
CONVERT img "RGBA" // convert to RGBA mode
RESIZE img (256, 256) // resize image to size 256 x 256
BLUR img 10 // blur the image by 10 deg
SAVE img 'OUTPUT.PNG' // save the image as output.png
(basic operators)
+addition : works onnumber,tuplesandsequences-*subtraction, multiplication : works onnumberonly/|division, floor-div : works onnumberonly^exponents : works onnumberonly
(properties) Examples:
WIDTH img-> int (width of the image)HEIGHT img-> int (height of the image)MODE img-> str (image mode) and more ...
(streams)
- streams can be passed in via the
streamskwarg inexecuteEX:runner.execute(..., streams=[BytesIO(some_bytes)]) - And can be accessed via
OPEN STREAM index AS ...
OPEN STREAM 0 AS img
INVERT img
SAVE img 'out.jpg'
- you can save output images into streams ex:
SAVE img STREAM 'png' - they can be accessed via
runner.streamswhich will returnList[BytesIO]
(sequences / GIFs)
NEW [] AS sequence // new empty sequence
OPEN 'frame1.png' AS frame1
APPEND frame1 TO sequence // append to sequence
OPEN 'frame2.png' AS frame2
APPEND frame2 TO sequence // append to sequence
SAVE sequence 'test.gif'
// specify duration and loop
SAVE sequence 'test.gif' DURATION 10 LOOP 0
// initialize sequence with existing frames
NEW [img, img2] AS seq
// initialize sequence from a gif image
NEW SEQUENCE img AS seq
(Iterating)
// iterate over a container
ITER ((0, 5, 1, 2) AS i) -> (
ECHO i
) // tuple
ITER ([img1, img2, img3] AS frame) -> (
APPEND frame TO something
) // sequence
ITER (RANGE (1, 20) AS deg) -> (
CLONE img AS clone
BLUR clone deg
SAVE clone STREAM 'PNG'
) // iter over a range and blur image by that degree
ITER (img AS frame) -> (
INVERT frame
) // iterates over an image and inverts each frame
// same effect as INVERT img,
// but that inverts the first frame only and makes it static
// which is fine for static images but not really for gifs
(pasting and blending)
BLEND img, img2 ALPHA 0.5 AS blended
PASTE img ON img2 (10, 10)
// with a mask
PASTE img ON img2 MASk mask (10, 10)
and more! (soon)
- fstop is still in early development
- bug fixes will come soon, open an issue if you encounter one :)
- more features to come
- more opencv features
- variable declaration
- better imagedraws
(Still a WIP)
Documentation
Contributors
- Tom-the-Bomb - Main dev of this impl
- MrKomodoDragon - Main dev of the
larkimplementation - Cryptex-github - helps with the docs
- Jay3332 - Helps with ideas, regex and other stuff
Metadata
Release files for f-stop 0.2.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| f-stop-0.2.14.tar.gz | 13.5 kB | Without provenance | Details for f-stop-0.2.14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| f_stop-0.2.14-py3-none-any.whl | Python 3 | none | any | Details for f_stop-0.2.14-py3-none-any.whl |
Total release size: 28.1 kB
Release files / f-stop-0.2.14.tar.gz
| Download URL | f-stop-0.2.14.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a7a3db60d685f4470af6488e7fe1baad7088e034e9fbe0c5c9ca44c74b7e0b5
|
|
BLAKE2b-256 checksum How to use checksums |
97c3f1fc3435222c686084c7e01ba744bd38ac37a0de6b670d7c2237cbf29cc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.10
|
Release files / f_stop-0.2.14-py3-none-any.whl
| Download URL | f_stop-0.2.14-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
06c4d680a4ca86c83f8d6893eb2d2c891ccd16de6e13d48091ebedaa1e70c83c
|
|
BLAKE2b-256 checksum How to use checksums |
ca1603b21f312e4166e259e82633129f2cfe9993d14a38d4e7cf2ad69e0d09f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.10
|
Security for f-stop 0.2.14
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.