#!/bin/bash

size=$(echo "$1" | tr '.' '\n' | tail -n 2 | head -n 1)
name=$(echo $1 | sed -e 's/\.[^.]*\.[^.]*$//')
convert "$1" rgb:"$name.new"
truncate "$name.new" --size=$size
ls -l "$name" "$1" "$name.new"
