Skip to content

Instantly share code, notes, and snippets.

@hyuki0000
Created May 27, 2017 02:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyuki0000/e745df346aeafe70488e57c7ae2e1b16 to your computer and use it in GitHub Desktop.
Save hyuki0000/e745df346aeafe70488e57c7ae2e1b16 to your computer and use it in GitHub Desktop.
transpoint - Twitterにpng画像をアップロードするときにjpeg圧縮が掛からないように右下隅の1ピクセルを透明にする
#!/usr/bin/env ruby
# http://www.mk-mode.com/octopress/2013/08/28/ruby-write-character-by-rmagick/
# http://www.gesource.jp/weblog/?p=194
# transpoint - Twitterにpng画像をアップロードするときにjpeg圧縮が掛からないように右下隅の1ピクセルを透明にする
require 'fileutils'
require 'RMagick'
def transpoint(image_filename)
image = Magick::ImageList.new(image_filename)
image.pixel_color(image.columns - 1, image.rows - 1, 'transparent');
image.write(image_filename)
end
if ARGV.length != 1
abort("Usage: transpoint filename.png")
end
filename = ARGV[0]
transpoint(filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment