diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e69de29..0000000 diff --git a/README.md b/README.md index c7d3363..b9cf1f4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ --> **Clone with option --recurse-submodules to fetch submodules directly when cloning** - This little personal project helps frame photos into frames of mockup rooms (mockup rooms not provided except small sample). You can use any mockup you want, portrait, square or landscape, and frame any photo you want to the right frames. The program will help you calibrate your mockups (to map where the frame is in the mockup room) and then assemble photos to them - it will automatically frame all landscape photos into landscape frame mockups, portraits into portrait frame mockups and square into square frame mockups. diff --git a/RELEASE.md b/RELEASE.md deleted file mode 100644 index e870228..0000000 --- a/RELEASE.md +++ /dev/null @@ -1,76 +0,0 @@ -This little personal project helps frame photos into frames of mockup rooms (mockup rooms not provided except small sample). -You can use any mockup you want, portrait, square or landscape, and frame any photo you want to the right frames. The program will help you calibrate your mockups (to map where the frame is in the mockup room) and then assemble photos to them - it will automatically frame all landscape photos into landscape frame mockups, portraits into portrait frame mockups and square into square frame mockups. - -~~It's all automatic and simple!~~ __It's all automatic and simple if it's set right (easy).__ - -## 1. Set the mockup frame information - -Take a mockup file with a frame in it. You need to know where the actual photo frame is in the mockup file. -To do so, use the program kshhhtest.py. - -It runs as such in a terminal: -```bash -./photoframer-/test/test - [-h] [-n] path/to/mockup framewidth [frameheight] framestartx framestarty -``` -- -h/--help: - Print this message -- -n/--no: - Automatically say no to renaming the mockup file to the recommended name - -- framewidth: width of frame the image will fit in -- frameheight: (optional if for square) height of frame the image will fit in -- framestartx: x coordinates where the frame starts int the mockup image from the top left corner -- framestarty: y coordinates where the frame starts int the mockup image from the top left corner - -Where you started the command, check the file __isItFramedOk.jpg__. -If the photo fits perfectly into the mockup frame, then rename your mockup file with the suggestion in the terminal. -If not perfect, reiterate with different parameters. Bear in mind, DO NOT allow for white spaces inside the frame - in other words, make your photo stick to the frame as accurately as possible, you will have the possibility to enter a mode later that puts white spaces as passepartouts*. - - -## 2. Frame all your photos - -Now that you have your mockups renamed okay, put all your mockups in the same directory. -Put all your photos you want to incorporate into these mockups in another directory. - -In a terminal, run: -```bash -./photoframer-/frame/frame - [-h] [-d] [-r] [-y] [-p] [--passepartout[=%off_frame_size]] - path/to/mockupdir path/to/photodir path/to/resultdir -``` -- -h/--help: - Print this message -- -d/--debug: - Enable debug messages -- -r/--resize: - Allow resizing of original photo to fit the frame -- -y/--yes: - Will not ask any question -- -p: - Set passepartout* on frames to 95% of frame longest edge -- --passepartout=off_frame_size: - Set passepartout* on frames to off_frame_size% of frame longest edge - -Bear in mind, passepartout* cannot be constant all around the photo if you don't enable the --resize option along with it. - -Mandatory arguments are: -- mockupdir: path to the directory containing the mockups - mockup files mush have the information on where the frame is in the following format: filename-\-s\x\c\x\.ext - orientation can be *portrait*, *landscape* or *square* -``` -Example: blue-wall-basic-11-square-s1279x1279c862x273.jpg livingroom-square-s1279x1279c862x273.jpg -``` -- photodir: path to the directory containing the photos to frame -- resultdir: existing path to the directory where the result images will be saved - -All paths must exist, even the path/to/resultdir. All your framed photos will be available in path/to/resultdir. - - -__/!\ Don't work with originals, work with copies! Original photos are never modified, BUT I'd advise to have a copy of them.__ - -Enjoy! -You like this? Be a sponsor at [https://github.com/Photography-Utils/photoframer]. - -Notes: -* What is a passepartout? It's the space left between the side of the frame and the photo, and it is optional. See more at [https://en.wikipedia.org/wiki/Mat_(picture_framing)] - - diff --git a/create_release.sh b/create_release.sh deleted file mode 100755 index eb0b666..0000000 --- a/create_release.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh - -if [ -z "$1" ]; then - echo "Usage: $0 version"; - exit 1; -fi; - -set -x - -echo "Get version from script argument" -version="$1" -tarballdirname="photoframer-$version" -tarballname="$tarballdirname.tar.gz" - -echo "Clean up before packaging" -rm -rf "$tarballname" -rm -rf "$tarballdirname" -rm -rf *.spec -rm -rf dist/ build/ -rm -rf __pycache__ - -echo "Create frame.py executable" -pyinstaller -y frame.py -pyinstaller -y frame.spec - -echo "Create test.py executable" -pyinstaller -y test.py -pyinstaller -y test.spec -cp -rf imageformockuptest.jpg dist/test/ - -echo "Include RELEASE.md and example files" -cp -rf RELEASE.md dist/ -cp -rf examples/resultexample.png dist/ - -echo "Prepare to create the tarball from dir $tarballdirname/" -mv dist $tarballdirname - -echo "Create the tarball $tarballname" -tar -cvzf $tarballname $tarballdirname - -echo "Create version git tag if result tarball exists" -test -f "$tarballname" && git tag $version - -echo "Clean up after itself" -rm -rf *.spec -rm -rf dist/ build/ -rm -rf __pycache__ -rm -rf "$tarballdirname" - -echo "Don't forget to sync the new tag : git push --tags" -echo "Now go to https://github.com/Photography-Utils/photoframer/releases and add your release to the new tag" diff --git a/frame.sh b/frame.sh index 6c9a378..3680fd8 100755 --- a/frame.sh +++ b/frame.sh @@ -1,4 +1,5 @@ #!/bin/sh # Just a wrapper for python -python3 frame.py "$@" +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +python3 "$DIR/frame.py" "$@" diff --git a/test.py b/test.py index 924847a..22cdead 100644 --- a/test.py +++ b/test.py @@ -15,10 +15,7 @@ def help(message = ""): print("\n"+message) def testMockup(mockuppath, framesize, framecoordinates, noask): - if getattr(sys, 'frozen', False): - application_path = os.path.dirname(os.path.abspath(sys.executable)) - elif __file__: - application_path = os.path.dirname(os.path.abspath(__file__)) + application_path = os.path.dirname(os.path.abspath(__file__)) testfilepath = os.path.join(application_path,"imageformockuptest.jpg") print("Mockup file image for frame test: "+testfilepath) @@ -38,7 +35,9 @@ def testMockup(mockuppath, framesize, framecoordinates, noask): # Add photo to frame at coordinates framed_im.paste(resizedphoto_im, framecoordinates) # Save result in working dir - framed_im.save(os.path.join(os.getcwd(), 'isItFramedOk.jpg')) + testresultfilename = 'isItFramedOk.jpg' + wheretosaveresultfile = os.getcwd() + framed_im.save(os.path.join(wheretosaveresultfile, testresultfilename)) # Helper for frame name in case it's good print("If this result is good (meaning you dimensioned the frame correctly and the photo fits perfectly in it), you should rename the frame as follows in order to use it as a frame for kshhhactivate:") @@ -60,6 +59,8 @@ def testMockup(mockuppath, framesize, framecoordinates, noask): os.rename(r''+mockuppath, r''+resultfile) print("File renamed, now ready to use with kshhhactivate.py") + print("\nCheck file "+testresultfilename+" at "+wheretosaveresultfile) + def main(argv): # Look for options diff --git a/test.sh b/test.sh index a619881..f29ad90 100755 --- a/test.sh +++ b/test.sh @@ -1,4 +1,5 @@ #!/bin/sh # Just a wrapper for python -python3 test.py "$@" +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +python3 "$DIR/test.py" "$@"