Skip to content

Commit

Permalink
Improve the visibility of spec numbers on images
Browse files Browse the repository at this point in the history
  • Loading branch information
sshaw committed Jun 30, 2016
1 parent 1af07fb commit f52f1ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ Upwards of 500 MB after 10 or 15 seconds.
1. Photos are taken every 300ms. Unused photos are cleaned up after every test completes but if a single test takes a while to
complete photos can start to eat up disk space.

1. Spec numbers are added to the top left of each image. They will not show up if the background is dark.

At some point I may write something that does not [fake the `Camera` interface via `fork`](https://github.com/sshaw/selfie_formatter/blob/34f1999391695ce7633d79638a0903e1eb612e9e/lib/selfie/camera.rb). [imagesnap](https://github.com/rharder/imagesnap) and [CaptureCamera](https://github.com/fernyb/CaptureCamera) are good starting points.

## License
Expand Down
12 changes: 4 additions & 8 deletions lib/selfie/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,15 @@ def capture(color)

def transform(path, color)
# TODO: options
# TODO: put number in a white box
image = MiniMagick::Image.new(path)
image.combine_options do |i|
i.resize "250x250>"
i.border "4x4"
i.bordercolor color
i.pointsize '26'
i.weight 'Bold'
# for 26 point
# count isn't available on Notification -of something?!
i.annotate "+10+30", @spec_count.to_s
# for 32 point
#i.annotate "+15+40", "#1000"
i.pointsize "26"
i.weight "bold"
i.undercolor "white"
i.annotate "+4+28", @spec_count.to_s
end
rescue MiniMagick::Error => e
raise Error, "image transformation failed: #{e}"
Expand Down

0 comments on commit f52f1ed

Please sign in to comment.