feat: image-converter project init
This commit is contained in:
16
image-converter/.editorconfig
Normal file
16
image-converter/.editorconfig
Normal file
@@ -0,0 +1,16 @@
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{md,py}]
|
||||
charset = utf-8
|
||||
|
||||
[*.py]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
3
image-converter/.gitignore
vendored
Normal file
3
image-converter/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/venv
|
||||
/venv/*
|
||||
__pycache__/
|
||||
16
image-converter/Makefile
Normal file
16
image-converter/Makefile
Normal file
@@ -0,0 +1,16 @@
|
||||
install:
|
||||
echo ">>> Installing dependencies"
|
||||
pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
|
||||
save:
|
||||
pip freeze > requirements.txt
|
||||
|
||||
run:
|
||||
python src/main.py
|
||||
|
||||
test:
|
||||
python -m pytest -v
|
||||
|
||||
setenv:
|
||||
python -m venv venv
|
||||
BIN
image-converter/foo.png
Normal file
BIN
image-converter/foo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 MiB |
6
image-converter/requirements.txt
Normal file
6
image-converter/requirements.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
iniconfig==2.3.0
|
||||
packaging==25.0
|
||||
pillow==12.1.0
|
||||
pluggy==1.6.0
|
||||
Pygments==2.19.2
|
||||
pytest==9.0.2
|
||||
6
image-converter/src/main.py
Normal file
6
image-converter/src/main.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from modules.raw_parser import (parse_raw_image)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parse_raw_image("./assets/foo.CR2", 2000)
|
||||
|
||||
9
image-converter/src/modules/raw_parser.py
Normal file
9
image-converter/src/modules/raw_parser.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from PIL import Image
|
||||
|
||||
def parse_raw_image(src,target_width, target_height):
|
||||
rawImage = Image.open(src)
|
||||
# Use the PIL raw decoder to read the data.
|
||||
# the 'F;16' informs the raw decoder that we are reading
|
||||
# a little endian, unsigned integer 16 bit data.
|
||||
# img = Image.fromstring('L', imgSize, rawData, 'raw', 'F;16')
|
||||
rawImage.save("foo.png")
|
||||
Reference in New Issue
Block a user