Last active
April 30, 2023 02:32
-
-
Save jcupitt/8939150 to your computer and use it in GitHub Desktop.
auto-crop in ruby-vips
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# "trim" is nnow built in, so this is easy | |
require 'vips' | |
im = Vips::Image.new_from_file(ARGV[0]) | |
left, top, width, height = im.find_trim | |
im = im.crop(left, top, width, height) | |
im.write_to_file(ARGV[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you. hm. seems
background: 0
did it. but the filesize is bigger after