Skip to content

Instantly share code, notes, and snippets.

@ongaeshi
Created January 8, 2017 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ongaeshi/086ffd836292ae4e4143242bae7f8e65 to your computer and use it in GitHub Desktop.
Save ongaeshi/086ffd836292ae4e4143242bae7f8e65 to your computer and use it in GitHub Desktop.
DST = 1280
i = Image.pick_from_library
puts "src: #{[i.w, i.h]}"
if i.w > DST
if i.w > i.h
j = i.resize(DST, i.h)
else
j = i.resize(i.w, DST)
end
puts "dst: #{[j.w, j.h]}"
puts j
j.save
puts "Save to the CameraRoll."
else
puts "Already width <= #{DST}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment