-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a quick TIL about removing letterbox frames
- Loading branch information
1 parent
b6c4945
commit b20280b
Showing
4 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
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> |
b20280b
There was a problem hiding this comment.
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
b20280b
There was a problem hiding this comment.
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