Select to view content in your preferred language

how to change the background of a raster from brown to white?

3258
6
Jump to solution
09-09-2019 03:17 AM
lubnajarara_ah
Occasional Contributor

Hi All,

 

I couldn’t figure out how to change the background of a raster from brown to white?

Please note that I want to make this change in the raw image not for displaying purpose using symbology (I want to make it permanent)

You can find a sample data from here

 

Best,

Lubna

1 Solution

Accepted Solutions
lubnajarara_ah
Occasional Contributor

Thanks Lance Cole

I used IrfanView software and I do the below steps to have the same result you had..

I will be very appreciated if you guide me if I can do this in one step instead of that

Best,

Lubna

View solution in original post

6 Replies
LanceCole
MVP Regular Contributor

lubna jarara'ah‌, 

The easiest way to do this is to simply resample the image file as a monochrome (Black and White) image.  You can do this in most image editors such as MS Paint or IrfanView.  Sample attached of your image.

lubnajarara_ah
Occasional Contributor

Thanks Lance Cole

I used IrfanView software and I do the below steps to have the same result you had..

I will be very appreciated if you guide me if I can do this in one step instead of that

Best,

Lubna

LanceCole
MVP Regular Contributor

Lubna‌,

Unfortunately, you do have to go through several steps to get the best result.  For one or two files this is not too much trouble but if you have many it is labor intensive.  ImageMagick to the rescue.  This is a command line tool that I have used for years to convert images in just about any way possible.  You can even script the tool for batch conversions.

Once installed you would convert your sample file from a Command Line using:

magick AlMazraaAlQibliya.jpg -colorspace Gray -threshold 50%  AlMazraaAlQibliya_tmp.jpg

or the following if you also want to change the file type

magick AlMazraaAlQibliya.jpg -colorspace Gray -threshold 50%  AlMazraaAlQibliya.tif

You may need to adjust the threshold value depending upon your images.  Please note, these images are still 8-bit images.  You could also apply additional conversion to change to true B&W 2-bit images, if needed. 

magick AlMazraaAlQibliya.jpg -colorspace Gray -threshold 50%  -colors 2 -depth 1 AlMazraaAlQibliya.tif

lubnajarara_ah
Occasional Contributor

Dear Lance Cole

I notice that after I change the background color using IrfanView software the classification of the image was color map and it have 255 color. My question there is a way to change them to 2 colors or 2 ranges (white and Black) in the same software not on the level of arcmap?

Best,

Lubna

LanceCole
MVP Regular Contributor

Lubna‌,

After you perform your Color Adjustments, add one additional step to Decrease Color Depth and select 2 colors (black/white) before you save the new file.

When you save the file as a new TIFF, you may need to set the Save Compression to one applicable to B&W images only.  Just check the Show options dialog box on the Save dialog for this to display.

Have a wonderful day.

lubnajarara_ah
Occasional Contributor

Thank you Lance Cole for Irfan View software.. All my issues are solved using it

 

Best,

Lubna