Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with a recolor of a folder of images to a set of hex colors.
#5
I'm very close to what I need in my batch programming.  but still need a bit of help if any here can lend a bit of a hand.at this time I need to strip out the original file extension form my %%a variable.
Code:
echo off
SETLOCAL EnableDelayedExpansion
for /f "tokens=*" %%x in (118_hex_colors.txt) do (
    for /r %%a in (*.png) do (
    echo %%a%%x.png
        rem above line is to ensure I'm passing Image Magick the correct final file name.
        rem magick %%a -colorspace gray -fill "#%%x" -tint 100 %%a%%x.png

    )
)


' Wrote:'rich2005My two euros worth.

For a batch operation Imagemagick (IM) http://www.imagemagick.org is more suited than Gimp.  Even so it is not going to be easy and I do not know the best way for a Windows user.

Using your examples and IM a single conversion is straight forward,  note the "#.." for the colour.

Code:
magick brick.png -colorspace gray -fill "#4c2c66" -tint 100 brick4c2c66.png

Long time since I last used a Windows .bat file (Any Windows user suggestions more than welcome)
In linux, for a single file, producing 118 variations would look like this where the file name is passed as variable $1  as: https://i.imgur.com/Svc0d3u.jpg

Gets even more complicated extracting just the tile name (without extension) in a further loop.
Sorry not a lot of help for you. You could ask on the IM forum https://github.com/ImageMagick/ImageMagick/discussions where one of the moderators is a Windows user.

Edit: Just wondering why the brick4c2c66.png filesize is larger than brick.png filesize both are RGB mode, I could not see anything obvious but it did bring up one thing. The IM script makes an indexed image. Identical to RGB version and obviously much smaller.
Attached the IM coloured file to compare:
Reply


Messages In This Thread
RE: Help with a recolor of a folder of images to a set of hex colors. - by Nmbr5 - 12-22-2021, 12:51 AM

Forum Jump: