Reputation: 2391
I am trying to convert images to rgb: (R:242 - G:235 - B: 190), but I can't seem to find the right command for that. All I found was this command that darkens the image, but when I changed gray47
to the numbers I want the output was black:
convert \
input.jpg \
-channel red -fx 'r - gray47' \
-channel green -fx 'g - gray47' \
-channel blue -fx 'b - gray47' \
output.jpg
ImageMagick version 6.8.9-9 Q16 x86_64
Or if any other command/script does that for Linux in bulk I am open to try anything else.
I want to batch colorize all images in a folder and subfolders from
to:
In ACDsee the colorize works well with these options, but it's slow and doesn't allow subfolders (for thousands of images):
Upvotes: 0
Views: 762
Reputation: 11179
If I understand you correctly, you want to adjust the whitepoint to make the new white 242, 235, 190.
You can do this by multiplying the channels by 255 / 242, 255 / 235, 255 / 190, or 1.05, 1.09, 1.34. You can use recolor
for this, eg.:
red_scale=1.05
green_scale=1.09
blue_scale=1.34
convert $infile -recolor "$red_scale 0 0 0 $green_scale 0 0 0 $blue_scale" $outfile
This is a 3x3 colour recombination matrix -- be careful to get all the 0s in the right place.
You could also consider libvips:
vips linear $infile $outfile "$red_scale $green_scale $blue_scale" "0 0 0"
It should be faster and use less memory.
Upvotes: 1
Reputation: 53089
It looks like you want a constant color output image in ImageMagick. You can do that by converting your colors to percent.
R:242 - G:235 - B:190
So
R=242/255=94.9%
G=235/255=92.2%
B=190/255=74.5%
Then
convert input.jpg -fill "srgb(94.9%,92.2%,74.5%)" -colorize 100 output.jpg
If on ImageMagick 7, then change convert
to magick
Upvotes: 1