Skip to content

Commit

Permalink
Add a quick TIL about removing letterbox frames
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwlchan committed Jun 8, 2024
1 parent b6c4945 commit b20280b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
Binary file added src/_images/2024/Unboxed.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/_images/2024/Unboxed_10.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/_images/2024/Windowboxed.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions src/_til/2024/2024-06-08-remove-letterboxing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
layout: til
date: 2024-06-08 11:11:25 +0100
title: Removing letterboxing from a video screenshot with ImageMagick
summary: |
Using `-trim` will remove the black portions and leave you the unletterboxed image.
tags:
- imagemagick
---
I was doing some work today with screenshots of a video that had [black "letterboxing" bars](https://en.wikipedia.org/wiki/Letterboxing_%28filming%29) around it.
If you use `convert [input] -trim [output]`, you can remove this with ImageMagick.

If the bars aren't pure black, you can add `-fuzz 10%` to pick up dark greys also.

<style>
#examples {
display: grid;
grid-template-columns: 250px auto;
grid-gap: 1em;
align-items: center;
}

#examples pre {
margin: 0;
}
</style>

<div id="examples">
<img src="/images/2024/Windowboxed.jpg" alt="">
<p>
Original file, from <a href="https://en.wikipedia.org/wiki/File:Windowboxed.jpg">Wikimedia Commons</a>
</p>

<img src="/images/2024/Unboxed.jpg" alt="">
<pre><code>convert Windowboxed.jpg -trim Unboxed.jpg</code></pre>

<img src="/images/2024/Unboxed_10.jpg" alt="">
<pre><code>convert Windowboxed.jpg -fuzz 10% -trim Unboxed.jpg</code></pre>
</div>

2 comments on commit b20280b

@alexwlchan
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://alexwlchan.net as production
🚀 Deployed on https://666430cf3f0dfbbadd7fd2dc--alexwlchan.netlify.app

@alexwlchan
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://alexwlchan.net as production
🚀 Deployed on https://66655ae4ca7ec39756ede8cc--alexwlchan.netlify.app

Please sign in to comment.