Problem: convert png all but black to white, convert to tif
Posted: 2009-06-29T00:43:08-07:00
Hi all.
(Before replying check P.P.S)
Here's a bit more detail to what I'm trying to accomplish. I have a png image that has graphics and text. All relevant text is black and that's all that interestes me so I want to remove everything else. So I do this:
It sort of works. The only problem is that afeter that when I try to convert the resulting png to tif the tif is somehow "corrupted".
IM Display does show the image just fine, but I can't open it in paint nor in the standard windows image viewer, so there must be something funny going on. When I use the identify tool I see that the image changes from 8-bit DirectClass png -> 8-bit PseudoClass png -> 8-bit Grayscale DirectClass tif
Perhaps that's the problem, but I have no idea how to force IM to output the black & white picture as if it was colored.
P.S. Almost the same thing happens if I do things in the opposite order, firts convert to tiff and then remove all but black. The only difference is that it the picture changes from:
8-bit DirectClass png -> 8-bit DirectClass tif -> 1-bit Bilevel DirectClass tif
P.P.S LOL. 2 seconds afeter posting this I came up with yet another thing to try and it worked. I reverserd the order (which was probly irrelevant) and added the trigger -type TrueColor and now it produces nicely working tiffs. I thoght I had tried that already, but perhaps I misspelled TrueColor or had the trigger in wrong place... sry for the ponitless post
(Before replying check P.P.S)
Here's a bit more detail to what I'm trying to accomplish. I have a png image that has graphics and text. All relevant text is black and that's all that interestes me so I want to remove everything else. So I do this:
Code: Select all
convert input.png ( +clone -matte -transparent black -fill white -colorize 100% ) -composite output.png
Code: Select all
convert output.png -compress None output.tif
Perhaps that's the problem, but I have no idea how to force IM to output the black & white picture as if it was colored.
P.S. Almost the same thing happens if I do things in the opposite order, firts convert to tiff and then remove all but black. The only difference is that it the picture changes from:
8-bit DirectClass png -> 8-bit DirectClass tif -> 1-bit Bilevel DirectClass tif
P.P.S LOL. 2 seconds afeter posting this I came up with yet another thing to try and it worked. I reverserd the order (which was probly irrelevant) and added the trigger -type TrueColor and now it produces nicely working tiffs. I thoght I had tried that already, but perhaps I misspelled TrueColor or had the trigger in wrong place... sry for the ponitless post