2017-04-23 09:36:10 +02:00
|
|
|
#!perl --
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Image::Magick;
|
|
|
|
|
|
|
|
sub resize{
|
2017-05-21 22:50:33 +02:00
|
|
|
my($src_file,$dst_file,$resize_w,$resize_h,$scale) = @_;
|
2017-04-23 09:36:10 +02:00
|
|
|
|
|
|
|
my $image = new Image::Magick;
|
|
|
|
|
|
|
|
$image->read($src_file);
|
|
|
|
|
|
|
|
my($src_w,$src_h) = $image->Get(qw( width height));
|
2017-05-21 22:50:33 +02:00
|
|
|
if( not ( $src_w and $src_h ) ){
|
|
|
|
warn "cant get image bound. $src_file\n";
|
|
|
|
return;
|
|
|
|
}
|
2017-04-23 09:36:10 +02:00
|
|
|
|
2017-05-21 22:50:33 +02:00
|
|
|
if($resize_w < 0 ){
|
|
|
|
# wが-1ならソース画像をxxxhdpi(x4)として扱い、$scaleに応じて縮小する
|
|
|
|
$resize_w = $src_w * ( $scale /4 );
|
|
|
|
$resize_h = $src_h * ( $scale /4 );
|
|
|
|
}else{
|
|
|
|
# wかhのどちらかが0なら、適当に補う
|
|
|
|
if( not $resize_w ){
|
|
|
|
$resize_w = $resize_h * $src_w / $src_h;
|
|
|
|
}elsif( not $resize_h ){
|
|
|
|
$resize_h = $resize_w * $src_h / $src_w;
|
|
|
|
}
|
2017-04-23 09:36:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$image -> Resize(
|
|
|
|
width => $resize_w,
|
|
|
|
height => $resize_h,
|
|
|
|
blur => 0.8,
|
|
|
|
);
|
|
|
|
$image -> Write( "png:$dst_file" );
|
|
|
|
print "$dst_file\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
my @scale_list = (
|
|
|
|
[qw( mdpi 1 )],
|
|
|
|
[qw( hdpi 1.5 )],
|
|
|
|
[qw( xhdpi 2 )],
|
|
|
|
[qw( xxhdpi 3 )],
|
|
|
|
[qw( xxxhdpi 4 )],
|
|
|
|
);
|
|
|
|
|
|
|
|
sub resize_scales{
|
|
|
|
my($src,$res_dir,$dir_prefix,$res_name,$w,$h)=@_;
|
2017-05-21 22:50:33 +02:00
|
|
|
if( $w < 0 ){
|
|
|
|
for(@scale_list){
|
|
|
|
my($dir_suffix,$scale)=@$_;
|
|
|
|
my $subdir = "$res_dir/$dir_prefix-$dir_suffix";
|
|
|
|
mkdir($subdir,0777);
|
2018-05-10 00:25:44 +02:00
|
|
|
unlink "$subdir/$res_name.webp";
|
2017-05-21 22:50:33 +02:00
|
|
|
resize( $src, "$subdir/$res_name.png", $w,$h,$scale);
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
for(@scale_list){
|
|
|
|
my($dir_suffix,$scale)=@$_;
|
|
|
|
my $subdir = "$res_dir/$dir_prefix-$dir_suffix";
|
|
|
|
mkdir($subdir,0777);
|
2018-05-10 00:25:44 +02:00
|
|
|
unlink "$subdir/$res_name.webp";
|
2017-05-21 22:50:33 +02:00
|
|
|
resize( $src, "$subdir/$res_name.png", $scale * $w, $scale * $h );
|
|
|
|
}
|
2017-04-23 09:36:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
my $res_dir = "app/src/main/res";
|
2017-05-04 01:11:05 +02:00
|
|
|
#resize_scales( "_ArtWork/ic_app_logo-512.png" ,$res_dir,"drawable","ic_app_logo",0,32);
|
2017-05-13 02:22:28 +02:00
|
|
|
|
|
|
|
#resize_scales( "_ArtWork/ic_launcher-1024.png" ,$res_dir,"mipmap","ic_launcher",0,48);
|
|
|
|
#resize_scales( "_ArtWork/ic_notification-817.png" ,$res_dir,"drawable","ic_notification",0,24);
|
2017-07-26 13:40:55 +02:00
|
|
|
#
|
|
|
|
#resize_scales( "_ArtWork/ic_launcher_20170513.png" ,$res_dir,"mipmap","ic_launcher",0,48);
|
|
|
|
#resize_scales( "_ArtWork/ic_notification_20150513.png" ,$res_dir,"drawable","ic_notification",0,24);
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#resize_scales( "_ArtWork/ic_hourglass_dark.png" ,$res_dir,"drawable","ic_hourglass_dark",0,32);
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#resize_scales( "_ArtWork/ic_follow_cross.png" ,$res_dir,"drawable","ic_follow_cross",0,32);
|
|
|
|
#resize_scales( "_ArtWork/ic_follow_cross_dark.png" ,$res_dir,"drawable","ic_follow_cross_dark",0,32);
|
|
|
|
#resize_scales( "_ArtWork/ic_follow_plus.png" ,$res_dir,"drawable","ic_follow_plus",0,32);
|
|
|
|
#resize_scales( "_ArtWork/ic_follow_plus_dark.png" ,$res_dir,"drawable","ic_follow_plus_dark",0,32);
|
|
|
|
#resize_scales( "_ArtWork/ic_followed_by.png" ,$res_dir,"drawable","ic_followed_by",0,32);
|
|
|
|
#resize_scales( "_ArtWork/ic_followed_by_dark.png" ,$res_dir,"drawable","ic_followed_by_dark",0,32);
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#resize_scales( "_ArtWork/media_type_gifv.png" ,$res_dir,"drawable","media_type_gifv",-1,-1);
|
|
|
|
#resize_scales( "_ArtWork/media_type_image.png" ,$res_dir,"drawable","media_type_image",-1,-1);
|
|
|
|
#resize_scales( "_ArtWork/media_type_unknown.png" ,$res_dir,"drawable","media_type_unknown",-1,-1);
|
|
|
|
#resize_scales( "_ArtWork/media_type_video.png" ,$res_dir,"drawable","media_type_video",-1,-1);
|
|
|
|
|
2017-09-03 18:36:15 +02:00
|
|
|
#resize_scales( "_ArtWork/hohoemi.png" ,$res_dir,"drawable","emoji_hohoemi",0,24);
|
|
|
|
#resize_scales( "_ArtWork/nicoru.png" ,$res_dir,"drawable","emoji_nicoru",0,24);
|
|
|
|
#resize_scales( "_ArtWork/ic_nicoru.png" ,$res_dir,"drawable","ic_nicoru",0,32);
|
|
|
|
#resize_scales( "_ArtWork/ic_nicoru_dark.png" ,$res_dir,"drawable","ic_nicoru_dark",0,32);
|
2017-07-27 12:56:12 +02:00
|
|
|
|
2017-09-04 11:40:13 +02:00
|
|
|
#resize_scales( "_ArtWork/ic_pin.png" ,$res_dir,"drawable","ic_pin",0,32);
|
|
|
|
#resize_scales( "_ArtWork/ic_pin_dark.png" ,$res_dir,"drawable","ic_pin_dark",0,32);
|
|
|
|
|
|
|
|
|
2017-12-22 07:55:34 +01:00
|
|
|
|
2018-02-06 21:41:30 +01:00
|
|
|
#resize_scales( "_ArtWork/v0.5.1/ic_launcher_foreground.png" ,$res_dir,"mipmap","ic_launcher_foreground",0,108);
|
|
|
|
#resize_scales( "_ArtWork/v0.5.1/ic_launcher_background.png" ,$res_dir,"mipmap","ic_launcher_background",0,108);
|
2018-04-21 01:16:44 +02:00
|
|
|
|
2018-05-10 00:25:44 +02:00
|
|
|
# resize_scales( "_ArtWork/ic_pulse.png" ,$res_dir,"drawable","ic_pulse",0,32);
|
2018-08-20 19:37:42 +02:00
|
|
|
#resize_scales( "_ArtWork/ic_bot.png" ,$res_dir,"drawable","ic_bot",0,24);
|
|
|
|
#resize_scales( "_ArtWork/ic_pin.png" ,$res_dir,"drawable","ic_pin",0,24);
|
|
|
|
|
2018-08-21 01:20:39 +02:00
|
|
|
#resize_scales( "_ArtWork/ic_cat.png" ,$res_dir,"drawable","ic_cat",0,24);
|
|
|
|
#resize_scales( "_ArtWork/ic_shield.png" ,$res_dir,"drawable","ic_shield",0,24);
|
2018-08-23 02:32:55 +02:00
|
|
|
#resize_scales( "_ArtWork/ic_mobile.png" ,$res_dir,"drawable","ic_mobile",0,24);
|
|
|
|
|
|
|
|
|
2018-08-24 13:40:19 +02:00
|
|
|
#resize_scales( "_ArtWork/misskey-reaction/btn_reaction_angry.png" ,$res_dir,"drawable","btn_reaction_angry",0,32);
|
|
|
|
#resize_scales( "_ArtWork/misskey-reaction/btn_reaction_confused.png" ,$res_dir,"drawable","btn_reaction_confused",0,32);
|
|
|
|
#resize_scales( "_ArtWork/misskey-reaction/btn_reaction_congrats.png" ,$res_dir,"drawable","btn_reaction_congrats",0,32);
|
|
|
|
#resize_scales( "_ArtWork/misskey-reaction/btn_reaction_hmm.png" ,$res_dir,"drawable","btn_reaction_hmm",0,32);
|
|
|
|
#resize_scales( "_ArtWork/misskey-reaction/btn_reaction_laugh.png" ,$res_dir,"drawable","btn_reaction_laugh",0,32);
|
|
|
|
#resize_scales( "_ArtWork/misskey-reaction/btn_reaction_like.png" ,$res_dir,"drawable","btn_reaction_like",0,32);
|
|
|
|
#resize_scales( "_ArtWork/misskey-reaction/btn_reaction_love.png" ,$res_dir,"drawable","btn_reaction_love",0,32);
|
|
|
|
#resize_scales( "_ArtWork/misskey-reaction/btn_reaction_pudding.png" ,$res_dir,"drawable","btn_reaction_pudding",0,32);
|
|
|
|
#resize_scales( "_ArtWork/misskey-reaction/btn_reaction_rip.png" ,$res_dir,"drawable","btn_reaction_rip",0,32);
|
|
|
|
#resize_scales( "_ArtWork/misskey-reaction/btn_reaction_surprise.png" ,$res_dir,"drawable","btn_reaction_surprise",0,32);
|
|
|
|
#
|
2018-10-28 14:08:10 +01:00
|
|
|
# resize_scales( "_ArtWork/ic_medal.png" ,$res_dir,"drawable","ic_authorized",0,24);
|
|
|
|
|
|
|
|
|
2018-10-30 20:29:00 +01:00
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_unread.png" ,$res_dir,"drawable","ic_unread",0,24);
|
|
|
|
|
2018-11-16 00:43:10 +01:00
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_requested_by.png" ,$res_dir,"drawable","ic_requested_by",0,32);
|
|
|
|
|
|
|
|
|
2018-11-18 22:15:07 +01:00
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/local-visibility/ic_local_home.png" ,$res_dir,"drawable","ic_local_home",0,32);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/local-visibility/ic_local_home_dark.png" ,$res_dir,"drawable","ic_local_home_dark",0,32);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/local-visibility/ic_local_lock.png" ,$res_dir,"drawable","ic_local_lock",0,32);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/local-visibility/ic_local_lock_dark.png" ,$res_dir,"drawable","ic_local_lock_dark",0,32);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/local-visibility/ic_local_lock_open.png" ,$res_dir,"drawable","ic_local_lock_open",0,32);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/local-visibility/ic_local_lock_open_dark.png" ,$res_dir,"drawable","ic_local_lock_open_dark",0,32);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/local-visibility/ic_local_ltl.png" ,$res_dir,"drawable","ic_local_ltl",0,32);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/local-visibility/ic_local_ltl_dark.png" ,$res_dir,"drawable","ic_local_ltl_dark",0,32);
|
|
|
|
|
2018-11-16 00:43:10 +01:00
|
|
|
|
2018-12-06 10:04:52 +01:00
|
|
|
# resize_scales( "../extra-SubwayTooter/_ArtWork/media_bg_dark.png" ,$res_dir,"drawable","media_bg_dark",0,24);
|
2018-10-28 14:08:10 +01:00
|
|
|
|
2019-01-16 13:33:07 +01:00
|
|
|
# resize_scales( "../extra-SubwayTooter/_ArtWork/nicodic.png" ,$res_dir,"drawable","nicodic",32,60);
|
|
|
|
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_blocked_by.png" ,$res_dir,"drawable","ic_blocked_by",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_follow_wait.png" ,$res_dir,"drawable","ic_follow_wait",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_follow_cross.png" ,$res_dir,"drawable","ic_follow_cross",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_follow_plus.png" ,$res_dir,"drawable","ic_follow_plus",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_followed_by.png" ,$res_dir,"drawable","ic_followed_by",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_followed_by_dark.png" ,$res_dir,"drawable","ic_followed_by_dark",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_list_list.png" ,$res_dir,"drawable","ic_list_list",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_list_tl.png" ,$res_dir,"drawable","ic_list_tl",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_list_member.png" ,$res_dir,"drawable","ic_list_member",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_hashtag.png" ,$res_dir,"drawable","ic_hashtag",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_hourglass.png" ,$res_dir,"drawable","ic_hourglass",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/local-visibility/ic_local_home.png" ,$res_dir,"drawable","ic_local_home",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/local-visibility/ic_local_home_dark.png" ,$res_dir,"drawable","ic_local_home_dark",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/local-visibility/ic_local_lock.png" ,$res_dir,"drawable","ic_local_lock",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/local-visibility/ic_local_lock_dark.png" ,$res_dir,"drawable","ic_local_lock_dark",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/local-visibility/ic_local_lock_open.png" ,$res_dir,"drawable","ic_local_lock_open",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/local-visibility/ic_local_lock_open_dark.png" ,$res_dir,"drawable","ic_local_lock_open_dark",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/local-visibility/ic_local_ltl.png" ,$res_dir,"drawable","ic_local_ltl",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/local-visibility/ic_local_ltl_dark.png" ,$res_dir,"drawable","ic_local_ltl_dark",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_nicoru.png" ,$res_dir,"drawable","ic_nicoru",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_pulse.png" ,$res_dir,"drawable","ic_pulse",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_requested_by.png" ,$res_dir,"drawable","ic_requested_by",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_vote.png" ,$res_dir,"drawable","ic_vote",0,24);
|
|
|
|
#resize_scales( "../extra-SubwayTooter/_ArtWork/ic_hashtag.png" ,$res_dir,"drawable","ic_hashtag",0,24);
|
|
|
|
|
|
|
|
resize_scales( "../extra-SubwayTooter/_ArtWork/ic_followed_by.png" ,$res_dir,"drawable","ic_followed_by",0,24);
|