View Single Post
Old 03-22-2023, 07:34 AM   #9
neil_swann80
0000000000101010
neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.
 
neil_swann80's Avatar
 
Posts: 5,892
Karma: 12981955
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
I wrote a batch script to simplify the ImageMagick conversion. Here's the code in case anyone finds it useful:

Code:
@ECHO OFF
TITLE Magick Bulk Convert

Setlocal EnableDelayedExpansion

SET /a i=0
SET /a j=0

::Sets working directory and creates output directory
%~d1
CD "%~p1"
IF NOT EXIST converted MD converted

::count images
FOR %%a in (*.png,*.jpg,*.jpeg,*.gif,*.bmp,*.webp) DO SET /a i+=1

::perfoms convert and calculates percentage done
FOR %%a in (*.png,*.jpg,*.jpeg,*.gif,*.bmp,*.webp) DO (
	magick convert %%a -gravity center -crop 3:4 -adaptive-resize 1072x1448^^! -colorspace gray -colors 16 converted\%%~na.bmp
	SET /a j+=1
	SET /a done=!j!*100/%i%
	CLS
	ECHO.
	ECHO Converting Images - !done!%%
	)
CLS
ECHO.
ECHO Process complete!
ECHO.
PAUSE
Obviously you need to have ImageMagick installed.

Save the text above into notepad, then rename from .txt to .bat

Place the batch script in a folder with the images you want converted, running it will convert images (bmp, gif. jpg, png, webp) to a grayscale 4-bit bmp image. It will also center-crop to a portrait 3:4 aspect ratio, before setting the final resolution (currently set for a HD3, but just edit the code to the resolution for your own device).

The batch script creates a folder called "converted" (in the directory the batch file is run from) and outputs to that folder. The batch file displays a percentage completion whilst running.
neil_swann80 is offline   Reply With Quote