Convert colours
Convert colours
Hi wonder if someone can help.
I am new to this sort of thing !
I have a load of images (templates of mats) The image is all black on a white background.
I want to change the black to red , while leaving the white as is.
I need to do this on mass for 700 images.
I need the file name to remain the same with say _red at end of file name.
I have been sent the following code however file name is changed to test. Can someone help please?
convert *.jpg +level-colors red,white test_red.jpg
I am new to this sort of thing !
I have a load of images (templates of mats) The image is all black on a white background.
I want to change the black to red , while leaving the white as is.
I need to do this on mass for 700 images.
I need the file name to remain the same with say _red at end of file name.
I have been sent the following code however file name is changed to test. Can someone help please?
convert *.jpg +level-colors red,white test_red.jpg
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Convert colours
What is your platform? Windows, Unix, Mac, or what?
snibgo's IM pages: im.snibgo.com
Re: Convert colours
Hi running on windows 7
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Convert colours
Code: Select all
for /F "usebackq" %%F in (`dir /b *.jpg`) do convert %%F -fill Red -opaque Black %%~nF_red%%~xF
snibgo's IM pages: im.snibgo.com
Re: Convert colours
Hi
This doesnt work ? The image remains the same colour ?
This doesnt work ? The image remains the same colour ?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Convert colours
Perhaps the images aren't really black. Put an example somewhere like dropbox.com and paste the URL here.
snibgo's IM pages: im.snibgo.com
Re: Convert colours
http://www.carmats-uk.com/product_images/1268-2OER.jpg
heres a link to one image.
i am using the below code.
This will change the colour from black to red and also resize .
Problem is if it has to do more than one image it then screws.
:copy
ren *.jpg *.JPG
md temp
md webready
l
copy *.JPG temp\*.JPG
cd temp
mogrify -resize 500x *.JPG
mogrify -annotate 0,0 '' -font Arial -pointsize 24 xc:grey30 -gravity NorthEast -draw "fill grey70 text 5,5 ''" *
mogrify -annotate 0,0 '' -font Arial -pointsize 24 xc:black -gravity NorthEast -draw "fill black text 6,6 '' text 5,5 '
convert *.jpg +level-colors red,white *.jpg
ren ??????????????????????????????????????????????????.JPG ??????????????????????????????????????????????????_red.jpg
cd ..
deltree temp
pause
heres a link to one image.
i am using the below code.
This will change the colour from black to red and also resize .
Problem is if it has to do more than one image it then screws.
:copy
ren *.jpg *.JPG
md temp
md webready

copy *.JPG temp\*.JPG
cd temp
mogrify -resize 500x *.JPG
mogrify -annotate 0,0 '' -font Arial -pointsize 24 xc:grey30 -gravity NorthEast -draw "fill grey70 text 5,5 ''" *
mogrify -annotate 0,0 '' -font Arial -pointsize 24 xc:black -gravity NorthEast -draw "fill black text 6,6 '' text 5,5 '
convert *.jpg +level-colors red,white *.jpg
ren ??????????????????????????????????????????????????.JPG ??????????????????????????????????????????????????_red.jpg
cd ..
deltree temp
pause
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Convert colours
My command works fine for me. IM v6.8.9-0 on Windows 8.1. If run from a command prompt, change each "%%" to "%".
You said "The image is all black on a white background" but it really has black, white and 4 shades of gray. This isn't surprising, as it is a jpg image. If you have any choice, NEVER use jpg for solid colours.
You said "The image is all black on a white background" but it really has black, white and 4 shades of gray. This isn't surprising, as it is a jpg image. If you have any choice, NEVER use jpg for solid colours.
snibgo's IM pages: im.snibgo.com
Re: Convert colours
I have removed the % and now nothing happens. I am now totally confused ?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Convert colours
Are you are running a BAT file, or typing the command at the prompt? What exactly is your command?
Nothing happens? No error message?
Nothing happens? No error message?
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Convert colours
What version of Imagemagick are you using? Perhaps you need to ugrade
You cannot use multiple inputs and make multiple outputs using convert.
Either of these work for me on my Mac (unix syntax). The first, however, puts a period before _red.jpg
The input data is in test1 and the results are put into test2 (test2 must exist)
This has the input data in test1 and puts the result in test1
This has the input data in test1 and puts the result in test2
Sorry I do not know the windows syntax.
You cannot use multiple inputs and make multiple outputs using convert.
Either of these work for me on my Mac (unix syntax). The first, however, puts a period before _red.jpg
The input data is in test1 and the results are put into test2 (test2 must exist)
Code: Select all
cd desktop/test1
mogrify -path /Users/fred/desktop/test2 -format _red.jpg +level-colors red,white "*.jpg"
Code: Select all
for img in $(ls); do
convert $img +level-colors red,white ${img}_red.jpg
done
This has the input data in test1 and puts the result in test2
Code: Select all
for img in $(ls); do
convert $img +level-colors red,white ../test2/${img}_red.jpg
done