Hi everybody,
I have pairs of fairly large binary tiff-files of same dimensions which need to be merged together.
The file data may look like that:
file1:
0000000000000000000000
0111111100000000000000
0100000100000000000000
0100000100000000000000
0100000100000000000000
0100000100000000000000
0111111100000000000000
0000000000000000000000
0000000000000000000000
file2:
0000000000000000000000
0000000000000001000010
0000000000000000100100
0000000000000000011000
0000000000000000011000
0000000000000000100100
0000000000000001000010
0000000000000000000000
0000000000000000000000
desired result:
0000000000000000000000
0111111100000001000010
0100000100000000100100
0100000100000000011000
0100000100000000011000
0100000100000000100100
0111111100000001000010
0000000000000000000000
0000000000000000000000
Any idea, how can do that? I studied the documentation, but surrendered...
merge binary files of same size
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: merge binary files of same size
I suppose 0 represents black, and 1 represents white? Then the output at each pixel should be the lighter of the inputs:
Code: Select all
magick in1.tiff in2.tiff -compose Lighten -composite out.tiff
snibgo's IM pages: im.snibgo.com
Re: merge binary files of same size
Hello snibgo,
thanks for your instant help. Unfortunately, I only get a totally white tiff as result:-(
BTW: typical file size ist 20000 times 35000 Pixels.
thanks for your instant help. Unfortunately, I only get a totally white tiff as result:-(
BTW: typical file size ist 20000 times 35000 Pixels.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: merge binary files of same size
I thought that each 0 or 1 was a pixel, but perhaps not. Please tell us what they represent.
Also tell us what version of IM you are using, on what platform.
Also tell us what version of IM you are using, on what platform.
snibgo's IM pages: im.snibgo.com
Re: merge binary files of same size
Thanks again for your help so far. I am using
ImageMagick 6.7.6-3 2012-04-28 Q16
in a cygwin Environment running on WIN 7. My files are one color, one bit per pixel. I do not know for sure, whether "1" means full Color or "no Color". I guessed "1" means full Color and so I created the example files.
I hope, that helps:-)
ImageMagick 6.7.6-3 2012-04-28 Q16
in a cygwin Environment running on WIN 7. My files are one color, one bit per pixel. I do not know for sure, whether "1" means full Color or "no Color". I guessed "1" means full Color and so I created the example files.
I hope, that helps:-)
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: merge binary files of same size
I think it wold help if you supplied links to example inputs files. Please make them small (eg no larger than 1000x1000).
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: merge binary files of same size
Binary does not support color. Binary is black and white only with 1 bit per pixel. So we do not know what you mean by color images with 1-bit per pixel. As snibgo suggested perhaps supplying your input files might help. Or explain the file format in more detail.
Perhaps you mean the images are binary as opposed to text format. But what is the bit depth per pixel per channel? Is it 8-bits per pixel per channel (as 24-bit color image)? What is the endian -- are the higher bits on the left or right of the 8bits.
Perhaps you mean the images are binary as opposed to text format. But what is the bit depth per pixel per channel? Is it 8-bits per pixel per channel (as 24-bit color image)? What is the endian -- are the higher bits on the left or right of the 8bits.