Move PNG files for Android and iOS project.
Suppose you have these images exported from Avocode in ~/Downloads/test
:
.
├── image_distance-hdpi.png
├── image_distance-mdpi.png
├── image_distance-xhdpi.png
├── image_distance-xxhdpi.png
└── image_distance-xxxhdpi.png
This script can help you to move these image files to your Android or iOS project easily based on the area of the images.
USAGE
movepng <target> <name> <exportDir> <images...>
ARGUMENTS
<target> Export target (android or ios) required
<name> File name of the moved files required
<exportDir> Export directory required
<images...> Image files required
Execute the script:
./movepng android example_image ~/Downloads/test_output ~/Downloads/test/image_distance-mdpi.png ~/Downloads/test/image_distance-hdpi.png ~/Downloads/test/image_distance-xhdpi.png ~/Downloads/test/image_distance-xxhdpi.png ~/Downloads/test/image_distance-xxxhdpi.png
It will output:
Moved [/Users/testing/Downloads/test/image_distance-mdpi.png] to [/Users/testing/Downloads/test_output/drawable-mdpi/example_image.png]
Moved [/Users/testing/Downloads/test/image_distance-hdpi.png] to [/Users/testing/Downloads/test_output/drawable-hdpi/example_image.png]
Moved [/Users/testing/Downloads/test/image_distance-xhdpi.png] to [/Users/testing/Downloads/test_output/drawable-xhdpi/example_image.png]
Moved [/Users/testing/Downloads/test/image_distance-xxhdpi.png] to [/Users/testing/Downloads/test_output/drawable-xxhdpi/example_image.png]
Moved [/Users/testing/Downloads/test/image_distance-xxxhdpi.png] to [/Users/testing/Downloads/test_output/drawable-xxxhdpi/example_image.png]
Inside the ~/Downloads/test_output
directory:
.
├── drawable-hdpi
│ └── example_image.png
├── drawable-mdpi
│ └── example_image.png
├── drawable-xhdpi
│ └── example_image.png
├── drawable-xxhdpi
│ └── example_image.png
└── drawable-xxxhdpi
└── example_image.png
Execute the script:
./movepng ios example_image ~/Downloads/test_output ~/Downloads/test/image_distance-mdpi.png ~/Downloads/test/image_distance-hdpi.png ~/Downloads/test/image_distance-xhdpi.png ~/Downloads/test/image_distance-xxhdpi.png ~/Downloads/test/image_distance-xxxhdpi.png
It will output:
Moved [/Users/testing/Downloads/test/image_distance-mdpi.png] to [/Users/testing/Downloads/test_output/example_image.png]
Skipped [/Users/testing/Downloads/test/image_distance-hdpi.png]
Moved [/Users/testing/Downloads/test/image_distance-xhdpi.png] to [/Users/testing/Downloads/test_output/example_image@2x.png]
Moved [/Users/testing/Downloads/test/image_distance-xxhdpi.png] to [/Users/testing/Downloads/test_output/example_image@3x.png]
Skipped [/Users/testing/Downloads/test/image_distance-xxxhdpi.png]
Inside the ~/Downloads/test_output
directory:
.
├── example_image.png
├── example_image@2x.png
└── example_image@3x.png