Last active
January 23, 2018 02:03
-
-
Save b-coimbra/6de86b5511c47430940b7e631b0e805b to your computer and use it in GitHub Desktop.
Script to rename .png files with their respective dimensions
This file contains hidden or 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 | |
# encoding: UTF-8 | |
Dir['*'].each { |f| | |
File.rename(f, ((File.binread(f.to_s)[0x10..0x18].unpack('NN')*?x + ' ' + f) if File.extname(f)[/\.png/])) if f != $0 | |
} rescue Errno::ENOENT abort '[!] Run as admin.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment