wvanbergen / chunky_png

Read/write access to PNG images in pure Ruby.
https://chunkypng.com
MIT License
1.05k stars 101 forks source link

ChunkyPNG can now trim solid borders from images. #46

Closed threeifbywhiskey closed 10 years ago

threeifbywhiskey commented 10 years ago

I suppose it's not a particularly useful feature given how long ChunkyPNG has been around, but every now and then one needs to trim a solid border of color from around an image, and this pull request provides that functionality. I had a nil check in at first, but that turned out to be unnecessary. This is my first contribution to an open-source project, so I hope it makes it in. :sweat_smile:

wvanbergen commented 10 years ago

Cool. Can you also add some tests to the test suite to verify it's behaviour?

threeifbywhiskey commented 10 years ago

Hey, Willem. The tests I've added aren't particularly thorough, but I hope they're enough for you to consider the new functionality covered. If not, I'd be happy to add a bit more. Either way, thanks for taking time out to give the new code a look. :smile:

wvanbergen commented 10 years ago

The cosmetic changes are OK. You can see the diff with whitespace changes ignored by adding ?w=1 to the url: https://github.com/wvanbergen/chunky_png/pull/46/files?w=1

wvanbergen commented 10 years ago

Except for my question, this looks good to me! By the way, I pushed a fix to the master branch that should fix the CI runs.

threeifbywhiskey commented 10 years ago

The ?w=1 trick is convenient, but I still pale at cluttering up my pull request. Thanks for not taking umbrage, of course. I noticed the Travis build had failed and wondered if I'd broken something, but the error message didn't seem to indicate it being my doing; I'm glad you could diagnose the issue and operate. :smiley:

Other than my potential mistake regarding that one line, it would seem images are now trim-able. Thanks for accepting my contribution, Willem. I look forward to several more in future if and when inspiration strikes.