giftrim 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NGRjMDE1YjM1MjM3ZmExN2ZjZWU5NjgyYjhiODJlZWY0MWYxYTgyOQ==
4
+ MjY2OTk0YzM2OTYzYjg2M2QxNjg5MjZlMTRmNTM1NzFkYzM0ODA0Ng==
5
5
  data.tar.gz: !binary |-
6
- NjVlMmM3ZTFjYjMwMmQ3YjkyM2ZmMTU5MWE0NzdmMWE4YmRhOWQxOA==
6
+ YTlmMTA4MGU3YjkzNGMwMmE0YjZhZWZkMDJjNThkOTYxZThhN2VkOA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MWNmNzQ3YzMzZWNlOWU0ZDJkMjllMWEwZjQ3MGJmOTRkZmM4ZDg3NjU1Yzgx
10
- ZGJhODY0MzkyOGU2YWU0M2MwODI1NjkxMDY2Njk4NzEyMGE4ODBkZTU0ZGJj
11
- MThmMjM0NDQwYzU5ZjFlZDVmOGM2YWJkMThhYjU1OGQ0OTI1NTA=
9
+ MjlkNmI3NmM5ZTQ4ZDNlMzM1NzkyNjQ1Mzc0ZjkyYmYwOWNhMjFmNTc0MzU0
10
+ ZDNkMDE3NjczZjBhM2U0Y2ZhMDI3Mjc0MTNiM2U2NWFlZjVmYzQzNTk0MjY4
11
+ NzQxZWQxNWJjZTlkN2EyMDQzMTU2NmQ1MDUwOGQ0MmM4ZjgyY2I=
12
12
  data.tar.gz: !binary |-
13
- NTg3ODM4ZDJkNmIxNWNiN2U0YzYzNjAyNzAwMzk0OGU4YTk4N2IyNGIwMDlj
14
- OWEwZmFiODBkNTVlZWJiMzM1ZTI5NDg2ZGEwMWM1MTNkYmQ2MjhkY2MwN2Y0
15
- N2E0MTg2NjFiOTRiMGJhYjk1YzE1YjQyYTc4OGYzMGZlMWQ1NWI=
13
+ MGRhZjAzZjBlMWQ0NGMwZDQzNGYwN2UwNzAzYjdlYjU3N2M2ZDgwMjYwNWEx
14
+ ZjYyMTE2NGVkNzJiODRmZTY3ZWU2ZTQzYThhYzQzMjg0Y2Q1MjAwODhlNDUz
15
+ YWNhMGE4NjE0MzFiZmE2MDdmMzdkYjBlYTIwNzY5OWFkYTNmMDA=
data/.travis.yml CHANGED
@@ -3,6 +3,7 @@ rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
5
  - rbx-19mode
6
+ - jruby-19mode
6
7
 
7
8
  before_install:
8
9
  - sudo apt-get update -qq
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Provide convenient methods for GIF optimizations using gifsicle
4
4
 
5
- Tested on the following Rubies: MRI 1.9.3, 2.0.0, Rubinius.
5
+ Tested on the following Rubies: MRI 1.9.3, 2.0.0, Rubinius, JRuby (1.9 mode).
6
6
 
7
7
  [![Gem Version](https://badge.fury.io/rb/giftrim.png)](http://badge.fury.io/rb/giftrim)
8
8
  [![Build Status](https://secure.travis-ci.org/l4u/giftrim.png?branch=master)](http://travis-ci.org/l4u/giftrim)
data/lib/giftrim.rb CHANGED
@@ -171,15 +171,30 @@ module Giftrim
171
171
  end
172
172
 
173
173
  def trim
174
- # --batch to modify the GIF file in place (not working for frames)
174
+ @outfile = Tempfile.new('giftrim_')
175
+ @outfile.binmode
176
+ @outfile.close
177
+
175
178
  frames = Giftrim::frame_number_wanted self.number_of_frames, 10
176
179
  frames_formatted = frames.map{|frame| "\"##{frame}\""}.join " "
180
+ command = "#{Giftrim.processor} --unoptimize -O2 --no-comments --no-names --delay 20 --same-loopcount --no-warnings --resize-fit '300x300' #{@path} #{frames_formatted} > #{@outfile.path}"
181
+ trim_run_command command
182
+ end
177
183
 
184
+ def trim_with_target_frame_number frame_number
178
185
  @outfile = Tempfile.new('giftrim_')
179
186
  @outfile.binmode
180
187
  @outfile.close
181
188
 
182
- command = "#{Giftrim.processor} --unoptimize -O2 --no-comments --no-names --same-delay --same-loopcount --no-warnings --resize-fit '300x300' #{@path} #{frames_formatted} > #{@outfile.path}"
189
+ frames = Giftrim::frame_number_wanted self.number_of_frames, 10
190
+ frames_formatted = frames.map{|frame| "\"##{frame}\""}.join " "
191
+ command = "#{Giftrim.processor} --unoptimize -O2 --no-comments --no-names --delay 20 --same-loopcount --no-warnings #{@path} #{frames_formatted} > #{@outfile.path}"
192
+ trim_run_command command
193
+ end
194
+
195
+ private
196
+ def trim_run_command command
197
+
183
198
  output = run_command command
184
199
  if output
185
200
  @tempfile = @outfile
@@ -1,3 +1,3 @@
1
1
  module Giftrim
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: giftrim
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leo Lou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-04 00:00:00.000000000 Z
11
+ date: 2013-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler