Skip to content

Instantly share code, notes, and snippets.

@xatier
Last active July 19, 2018 08:19
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save xatier/971e1abe16f3bcbc51d9 to your computer and use it in GitHub Desktop.
Save xatier/971e1abe16f3bcbc51d9 to your computer and use it in GitHub Desktop.
extract stickers to WebP format from LINE.app cache
#!/usr/bin/env perl
#####################################################
## LINE stickers extractor
##
## extract stickers to WebP format from LINE.app cache
##
## Author: @xatierlikelee
## License: GPL
######################################################
#
#
#
# 1. pull all LINE stickers from you phone
#
# adb pull /storage/sdcard0/Android/data/jp.naver.line.android/stickers/
#
# 2. execute this script
#
# ./s.pl
#
# 3. the preview of extracted stickers will be in ./previews
# the extracted stickers will be packed in ./packs
#
######################################################
use 5.018;
mkdir "previews";
my @dirs = glob("./stickers/*");
for my $dir (@dirs) {
my $id = (split /\//, $dir)[-1];
for my $file (glob("$dir/*")) {
if ($file =~ /preview/) {
say "extracting preview $file";
system "cp $file ./previews/$id.png";
}
}
}
mkdir "packs";
for (glob("./previews/*")) {
my $id = (split /\//, (substr $_, 0, -4))[-1];
say "extracting ID $id => ./packs/$id";
mkdir "./packs/$id";
system "cp ./stickers/$id/* ./packs/$id/ ;" .
"cd ./packs/$id/ ;" .
"rm *_key preview thumbnail *.tmp ;" .
'for i in *; do cwebp $i -o $i.webp ; done ;' .
'for i in `ls | grep -v webp`; do mv $i $i.png; done ;' .
"cd ../../";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment