Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update from pehyy #37

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified logos/collage_four_square_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed logos/collage_nine_square.png.png
Binary file not shown.
Binary file removed logos/collage_nine_square_logo.png
Binary file not shown.
Binary file added logos/single_square_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion scripts/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Configuration():
# default values
user_name = None
logo_file = None
countdown1 = 5 # seconds of preview before first snap
countdown1 = 10 # seconds of preview before first snap
countdown2 = 3 # seconds of preview between snaps (Four pictures mode)
photoCaption = "" # Caption in the photo album
ARCHIVE = True # Do we archive photos locally
Expand Down
28 changes: 16 additions & 12 deletions scripts/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@
# Animation : animated gif
EFFECTS_PARAMETERS = {
"None": {
'snap_size' : (1640,1232), #(width, height) => preferably use integer division of camera resolution
'logo_size' : 128, # height in pixels of the logo (will be thumbnailed to this size)
'logo_padding' : 32 # bottom and right padding of the logo (pixels)
'snap_size' : (3280,2464), #(width, height) => preferably use integer division of camera resolution
'foreground_image' : "../logos/single_square_logo.png"
},
"Four": {
'snap_size' : (820,616), #(width, height) of each shots of the 2x2 collage
'snap_size' : (3280,2464), #(width, height) of each shots of the 2x2 collage
'foreground_image' : "../logos/collage_four_square_logo.png" # Overlay image on top of the collage
},
"Nine": {
Expand All @@ -62,17 +61,17 @@
"icon" : os.path.join("ressources","ic_four.png"),
"order":1
},
"Nine": {
"icon" : os.path.join("ressources","ic_nine.png"),
"order":2
},
# "Nine": {
# "icon" : os.path.join("ressources","ic_nine.png"),
# "order":2
# },
"None": {
"icon" : os.path.join("ressources","ic_portrait.png"),
"order":0
},
"Animation": {
"icon" : os.path.join("ressources","ic_anim.png"),
"order":3
# },
# "Animation": {
# "icon" : os.path.join("ressources","ic_anim.png"),
# "order":3
}
}

Expand Down Expand Up @@ -201,6 +200,11 @@
os.path.join("ressources","count_down_3.png"),
os.path.join("ressources","count_down_4.png"),
os.path.join("ressources","count_down_5.png"),
os.path.join("ressources","count_down_6.png"),
os.path.join("ressources","count_down_7.png"),
os.path.join("ressources","count_down_8.png"),
os.path.join("ressources","count_down_9.png"),
os.path.join("ressources","count_down_10.png"),
os.path.join("ressources","count_down_ready.png")]
# this defines the height ratio of the countdown images wrt. the preview size
COUNTDOWN_IMAGE_MAX_HEIGHT_RATIO = 0.2 #[0. - 1.] range
Expand Down
Binary file added scripts/ressources/count_down_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added scripts/ressources/count_down_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added scripts/ressources/count_down_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added scripts/ressources/count_down_8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added scripts/ressources/count_down_9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions scripts/user_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,23 @@ def snap(self,mode="None"):
snapshot.paste(config.logo,(xoff, yoff), config.logo)
except Exception as e:
self.log.warning("Could not add logo to image : %r"%e)
#paste the collage enveloppe if it exists
try:
self.log.debug("snap: Adding the collage cover")
size = snapshot.size
front = Image.open(EFFECTS_PARAMETERS[mode]['foreground_image'])
front = front.resize((size[0],size[1]))
front = front.convert('RGBA')
snapshot = snapshot.convert('RGBA')
#print snapshot
#print front
snapshot=Image.alpha_composite(snapshot,front)

except Exception, e:
self.log.error("snap: unable to paste collage cover: %s"%repr(e))

self.status("")
snapshot = snapshot.convert('RGB')
self.log.debug("snap: saving snapshot")
snap_filename = 'snapshot.jpg'
snapshot.save(snap_filename)
Expand Down