peterrenshaw / pypilo

Pre-processor for PyFlick. Images from desktop to Flickr.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

                            ___             
                        __ /\_ \            
 _____   __  __  _____ /\_\\//\ \     ___   
/\ '__`\/\ \/\ \/\ '__`\/\ \ \ \ \   / __`\ 
\ \ \L\ \ \ \_\ \ \ \L\ \ \ \ \_\ \_/\ \L\ \
 \ \ ,__/\/`____ \ \ ,__/\ \_\/\____\ \____/
  \ \ \/  `/___/> \ \ \/  \/_/\/____/\/___/ 
   \ \_\     /\___/\ \_\                    
    \/_/     \/__/  \/_/                    

    Pre-processor for PyFlick. 
    Images from desktop to Flickr.


    # default: process JPG/PNG images
    ./process.py -i path/to/source/image_dir/
                 -o path/to/destination/image_dir

    # process JPG images
    ./process.py -i path/to/source/image_dir/
                 -o path/to/destination/image_dir
                 -j 

    # process PNG images
    ./process.py -i path/to/source/image_dir/
                 -o path/to/destination/image_dir
                 -p 

    -i source image directory
    -o processed image destination directory
    -j process JPG images
    -p process PNG images
    -h help

    nb: updated ip for gitolite? 
        try 'git remote set-url origin git@ip.address:pypilo'


2020AUG19
* still testing

* working on:
- smoke test images
- jpg images
- png images
- video 

* if a small image is being resized, why?
- test if size < resize, if so don't resize
- resizing puts artifacts into images.

* error in logic for process.process
- reporting not processed, in fact had

* next refactor use below code for ext in tools.filepath2title 

    ext = os.path.splitext(filename)[1].lower()

* smoke test

- bug: donno why or how to fix: see BUGS

- wow uncovered something I didn't think about:

  The original code was written to handle uniform images
  with uniform regular filenames, sizes etc.

- so when I use test data with lots of various parameters
  things like re-sizing are going show up.

- tools.filepath2title, 2 bugs
- pil_tools.pil_resize 1 bug

* view through changes made
- process.main cleared up

- process.process_image 
+ needs another look at

- cleaned up pil_tools.py


- cleaned up tools.py
- tools.filepath2title: What was I thinking writing this? 
- Fixed and simplified to shite.

2020AUG18
* set up new github pypilo
- git remote add pypilo https://github.com/peterrenshaw/pypilo.git

  <https://docs.github.com/en/github/importing-your-projects-to-github/adding-an-existing-project-to-github-using-the-command-line>

* hack checkin'
- processed files
- uploaded & worked

* problem with tools.filepath2title
- needs fixing.

* hack
- tools.get_fn_png already exited
- ext contst to pil_tools
- sorc: <https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#png>


* default CLI input processes all supported files
- png
- jpg
- skips .mp4, etc.

* TODO
- checked the BUGS and todo file 

* EST: 1 Hour hack, 30min test & changes. 
* Here's what we do: 
- use command line option -p
- add another command line option, -p forcing file .EXT to .png
- defaults to -j which forces the file .EXT to .jpg

- in process.py, the tools exist to differenciate file extensions
+ write another function to test this

- in pil_tools.py, pil_resize is called
+ in the pil_tools.pil_resize a call to PIL image operations
  might require some PNG specific changes.
+ it might pay to report EXT, ipso facto EXT might need to be
  an argument or determined internally

* what it doesn't process .png?
- lets fix this

* sorc <https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#png>


2019NOV28
* beast failed on video upload
- sig on process.process_image was wrong
- fixed and tested 

2019OCT29
* ran into a problem with a smaller non standard image
- would not upload or resize and halted to workflow
- just as it was designed too.

* So I re-figured the code to allow for any size and 
- resize to the specified ratio.

* fixed so exits report errors to console

2019OCT26
* New bug listed (is it? but I should solve)
- fails: problem with input
- doesn't work with .PNG

* fails on /usr/bin/python
- works on /usr/bin env python3

* failed first use today
- pil_tools failed on running using py3
- solution?

  sudo port selfupdate
  sudo port upgrade updated

- re-install Pillow
  <https://pillow.readthedocs.io/en/latest/installation.html>

  $ sudo pip install Pillow
  $ python3 process.py -h 

  Options:
  -h, --help            show this help message and exit
  -i INPUT, --input=INPUT
                        input source directory
  -o OUTPUT, --output=OUTPUT
                        output source directory
  -j, --jpg             process only jpg files

2019OCT12
* had to reset the IP for gitolite access
- <https://stackoverflow.com/questions/2432764/how-to-change-the-uri-url-for-a-remote-git-repository>

  git remote set-url origin git@ip.address:pypilo

* wrapper for processing for image and videos
- new function processing.process()

  process(afiles, dest_fp)

  afiles:  list of filepathsnames 
  dest_fp: destination filepath

2019SEP21
* added viewdate.py to test for dates
- changed from UTC to localtime for dates created
* curating the source
- pil_resize has a problem because it shoves thru all files
  not just jpgs which I want to resize. 
- introduce idea of curating the source file so we control
  what is processed by what is in the source directory.
- that is until we write code to handle the edge cases such
  as mp4s, gifs etc.

2019SEP18
* bug on pil_tools.py
- function calc_image_size with barfed args
- fixed
    
2019SEP17
* lots of internal changes
- moved PIL code into pil_tools.py
- other tools into tools.py
- added BUGS, TODO

* check TODO
* copying to remote repro
* documentation
* fixed the bugs in BUGS
* working on this for a while

About

Pre-processor for PyFlick. Images from desktop to Flickr.


Languages

Language:Python 100.0%