forum

Automatic resizing for @2x!

posted
Total Posts
3
Topic Starter
Ruirize
So I'm in the process of making a 2x skin for mania! and I was getting pretty bored of scaling everything down.
I became lazy and wrote a batch script (Windows only) that uses ImageMagick to resize and rename a set of @2x images.

You need to have ImageMagick installed and available through the console.
You can get ImageMagick here!

To get the script to run, create a text document in the skin folder, paste the code below into it, and rename it to have a .bat extension.
You will then be able to double-click the .bat to run the script.
PNG Resizing
SETLOCAL EnableDelayedExpansion
for /f %%a IN ('dir /b *@2x.png') do (
set a=%%a
convert "%%a" -resize 50%% "!a:~0,-7!.png"
)
echo Finished!
pause
JPG Resizing
SETLOCAL EnableDelayedExpansion
for /f %%a IN ('dir /b *@2x.jpg') do (
set a=%%a
convert "%%a" -resize 50%% "!a:~0,-7!.jpg"
)
for /f %%a IN ('dir /b *@2x.jpeg') do (
set a=%%a
convert "%%a" -resize 50%% "!a:~0,-8!.jpeg"
)
echo Finished!
pause
If you do not want the window to stay open once it is complete, remove the last line ("pause") from the script.

It will scale the image down 50%, and output a file without the @2x on the end, so you'll need to make the @2x versions first.
It will only touch files ending in @2x. It will overwrite existing files.

Enjoy!
TakuMii
This works really nicely! Thanks for this, it'll save a lot of time and effort when I'm skinning.
Topic Starter
Ruirize

YayMii wrote:

This works really nicely! Thanks for this, it'll save a lot of time and effort when I'm skinning.
No problem ;) I have just added a script to do the same for .jpg and .jpeg files, so if you use them in your skin it might be an idea to get that too.
Please sign in to reply.

New reply