惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
G
Google Developers Blog
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
P
Proofpoint News Feed
J
Java Code Geeks
U
Unit 42
云风的 BLOG
云风的 BLOG
阮一峰的网络日志
阮一峰的网络日志
N
Netflix TechBlog - Medium
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
Docker
V
Visual Studio Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
V
V2EX
T
Tailwind CSS Blog

Danb Blog

August 2026: What I've Been Working On · Danb Blog Great Tech: Intel 2500k CPU · Danb Blog July 2026: What I've Been Working On · Danb Blog My Experience with Ubuntu Desktop 26.04 · Danb Blog Thumbnails for Orca 3MF in GNOME Files · Danb Blog Cheaper Sodastream Gas with a Big Tank · Danb Blog June 2026: What I've Been Working On · Danb Blog Running Snyk On Forgejo/Codeberg Actions · Danb Blog Tuta & Proton: An Open Source Client Does Not Result in an Open Source Service · Danb Blog May 2026: What I've Been Working On · Danb Blog 3D Printing Parts for my Greenhouse, Round 2 · Danb Blog Great Devices: Nexus 7 2013 · Danb Blog R36S Console RetroArch Stuck Menu Issue · Danb Blog April 2026: What I've Been Working On · Danb Blog Basic OpenCode Sandboxing with Docker · Danb Blog Games Played in 2025 · Danb Blog March 2026: What I've Been Working On · Danb Blog Shivam Mathur's "node-docker" Images are Awesome for PHP CI · Danb Blog February 2026: What I've Been Working On · Danb Blog Your BookStackApp project was assigned as a project for my Software Architecture course · Danb Blog My Sovol SV08 3D Printer Setup in 2026 · Danb Blog January 2026: What I've Been Working On · Danb Blog Epson Printer: The administrator password you entered was not recognized · Danb Blog Pressure to Follow Process · Danb Blog Online Shopping Email Notifications · Danb Blog My HomeLab Setup in 2026 · Danb Blog Linux Label Printing with the Phomemo D30 · Danb Blog Reporting to the CMA: Google Android Developer Verification · Danb Blog OPNsense & Dnsmasq: Responding with specific DNS servers · Danb Blog An Impromptu Introduction to ZFS Drive Replacement at 1am · Danb Blog
Migrating Google Photos to my Personal NAS · Danb Blog
2022-10-07 · via Danb Blog

Recently I’ve been working to somewhat detach myself from Google services after seeing growing reported cases of users being suddenly locked out of their account without any possible recourse.

As part of this, I had about 5 year’s worth of photos stored solely within Google Photos that I wanted to migrate and organise within my personal NAS storage.

Initial Export

Grabbing all my Google Photos content was pretty easy. It was just a case of using Google Takeout to generate a bulk export. The export was split, in my case, across multiple .tgz files of a chosen 10GB size. I chose this instead of 50GB to keep download chunks a little more manageable in the event of connection failure during download.

Once my export was ready, a few hours after, I downloaded the archives, extracted them and combined them into a single folder to centralise things. One minor annoyance was the amount of duplicates due to the same file being stored across albums & other folders. I organised and de-duped everything into my own custom structure before cleaning up the files and compressing using the scripts below.

Cleaning Up JSON Files

The export will contain a lot of JSON files for album and photo metadata. I didn’t care about these at all so running the below from the root photo folder directory quickly took care of those:

find ./ -type f -name '*.json' -delete

“Edited” Image Versions

Many images had copies with -edited appended to their name. Some of these were my own edits via Google Photos, but many others I assumed to be auto-edits by Google Photos. Again, I didn’t care about these so a quick find command from the root photo folder got rid of them:

find ./ -type f -iname '*-edited.jpg' -delete

Compressing Images to WebP

The export resulted in many gigabytes of JPG images. Many of these were very high resolution and thus individually quite significant in size. I didn’t want to delete images, but at the same time, wanted to regain some space. I decided to compress down many old images to reasonable quality WebP images. To be space efficient I was using lossy WebP so I’d lose some image quality to achieve this but that was a trade-off I thought was fair to keep all images. For a select few important images, I set them aside and out of the scope of my compression commands.

These are the commands I used for this compression:

# Convert jpg images, within the current directory, over 1MB to WebP
# Requires parallel, imagemagick and find to be installed.
# Runs the compression across threads in parallel for maximum speed-up.
# WARNING: This compression is lossy (Quality will be lost).
find ./ -type f -iname '*.jpg' -size +1M -print0 | parallel -0 mogrify -format webp -quality 80 {}

# Find and delete the old jpg images we converted above
find ./ -type f -iname '*.jpg' -size +1M -delete

Just a consideration on using WebP, while generally quite well supported now their support is still not as universal on jpeg. I use WebP here since I’ve found the lossy compression format to produce less artifacts while allowing smaller file sizes.

You can play with the -quality 80 number to get the balance of quality/filesize you desire. I’d usually spot-check a few images before running the second delete command to ensure I was getting the right output. For some specific directories, with images of very little sentimental value, I’d lower this down to 60 for even better compression ratios.

Compressing MP4 Videos

My export contained many videos I had taken with my phone. Like with images, I wanted to keep these and was happy to compress, at a loss of quality, to retain them with a smaller filesize.

I did this with the following bash script:

# Find mp4 videos in the current directory and convert each via FFMPEG
# to lower quality mp4 videos.
# WARNING: This compression is lossy (Quality will be lost).
for filepath in ./*.mp4
do
filename=$(basename -s ".mp4" "$filepath")
echo $filename
ffmpeg -i "$filepath" -vcodec libx264 -crf 32 "cmp-$filename.mp4"
done

There’s no deletion of old videos in the above since I did that manually afterwards. I did play with newer video codecs (vp9, h265) but found the vastly slower encoding speed, to gain a better size/quality output, was not worth it for my use. I also roughly played with the -crf value in the above to land on 32 as the output quality I was happy with.

Future Photo Handling

While I’ve migrated my existing content from Google Photos, I’ll probably still continue to use it for temporary phone photo backup, since it’s proved pretty reliable and seamless for that use. Every so often, I’ll take the content and archive it within my NAS as I’ve done above for long-term safe-keeping.

A Note on Compression

As mentioned above, I’ve made heavy use of lossy compression for my content. When using lossy compression you need to be aware you’ll lose quality/data on each compression pass, so you’d only want to compress in this way once, or ideally not compress at all.

For me, I wanted the keep storage space reasonable. I had plenty of space on my NAS to store all original content, but my main concern was long-term backup storage, since I’d be syncing these files from my NAS to Backblaze B2.