mmb-iphone_polaroid 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.textile CHANGED
@@ -19,6 +19,6 @@ require 'iphone_polaroid'
19
19
 
20
20
  img = Magick::Image::read('input.jpeg').first
21
21
 
22
- img.polaroid.write('polaroid.jpeg')
22
+ img.iphone_polaroid.write('polaroid.jpeg')
23
23
  </code>
24
24
  </pre>
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'iphone_polaroid'
3
- s.version = '0.0.2'
3
+ s.version = '0.0.3'
4
4
  s.date = '2009-04-05'
5
5
  s.summary = 'Make iPhone camera pictures look like Polaroids'
6
6
  s.email = 'matthewm@boedicker.org'
@@ -50,7 +50,7 @@ module IPhonePolaroid
50
50
  @lon
51
51
  end
52
52
 
53
- def polaroid(options={})
53
+ def iphone_polaroid(options={})
54
54
  o = {
55
55
  :photo_width => 216,
56
56
  :photo_height => 225,
@@ -83,21 +83,27 @@ module IPhonePolaroid
83
83
  img = border.composite(img, Magick::NorthWestGravity, o[:border_width],
84
84
  o[:border_width], Magick::OverCompositeOp)
85
85
 
86
- caption = exif.date_time.strftime('%m/%d/%Y').sub(/(^|\/)0/, '\1')
86
+ unless exif.date_time.nil?
87
+ caption = exif.date_time.strftime('%m/%d/%Y').sub(/(^|\/)0/, '\1')
88
+ else
89
+ caption = ''
90
+ end
87
91
 
88
92
  unless lat.nil? or lon.nil?
89
93
  caption =
90
94
  "#{caption} #{IPhonePolaroid.lat_lon_to_city_state(lat, lon)}"
91
95
  end
92
96
 
93
- text = Magick::Draw.new
94
- text.annotate(img, 0, 0, 0, o[:border_width], caption) {
95
- self.fill = o[:text_fill]
96
- self.font = o[:text_font]
97
- self.gravity = o[:text_gravity]
98
- self.pointsize = o[:text_size]
99
- self.stroke = o[:text_stroke]
100
- }
97
+ unless caption.empty?
98
+ text = Magick::Draw.new
99
+ text.annotate(img, 0, 0, 0, o[:border_width], caption) {
100
+ self.fill = o[:text_fill]
101
+ self.font = o[:text_font]
102
+ self.gravity = o[:text_gravity]
103
+ self.pointsize = o[:text_size]
104
+ self.stroke = o[:text_stroke]
105
+ }
106
+ end
101
107
 
102
108
  img.background_color = 'none'
103
109
  amplitude = img.columns * o[:amplitude]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mmb-iphone_polaroid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew M. Boedicker