floodfill always ends up with transparent image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Specialist
Posts: 2
Joined: 2014-07-28T15:00:42-07:00
Authentication code: 6789

floodfill always ends up with transparent image

Post by Specialist »

I have a script, which uses ImageMagick's convert command to floodfill an image, which has a black bar on the bottom and right page border, from the bottom right corner (to eliminate scanning artifacts). The rest of the image is mostly white:

Code: Select all

convert input.tif -fill white -draw "color 4879,6952 floodfill" +matte output.tif
(This example is for an image sized 4880x6953 px).

Previously, this worked fine on Ubuntu 12.04, which ships with ImageMagick 6.6.9.7. After upgrading to Ubuntu 14.04, which ships with v6.7.7.10, however, this command just produces a completely transparent image (instead of an image with the black bars replaced by white).

Any ideas?

Thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: floodfill always ends up with transparent image

Post by fmw42 »

You are likely just floodfilling the bottom right where it is black. You will need to floodfill from the top left as well, so that you get both black and white floodfills. Sounds like the older IM had a bug. The current version is likely doing it right. If the color in the bottom left and top right are close to each other, then you can just add -fuzz XX% and do it in one location. You may still need -fuzz XX% to get it right with two floodfills.

You could upload your image to someplace like dropbox.com (public folder) and put the URL here so we can actually see what your image is like.
Specialist
Posts: 2
Joined: 2014-07-28T15:00:42-07:00
Authentication code: 6789

Re: floodfill always ends up with transparent image

Post by Specialist »

The input is a monochrome image, which has the black bars in the bottom and right. The intention is to just fill that black portion. For an anonymized example, see: https://secure.tgbyte.de/dropbox/hcPrJtJsGzHO75WZ.tif

I want the main portion of the document to remain intact and just overwrite the black frame on the right and bottom with white. With v6.7.7.10 the whole image ends up as one large transparent area.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: floodfill always ends up with transparent image

Post by snibgo »

On IM v6.8.9-5 on Windows 8.1, this works fine:

Code: Select all

F:\web\im>%IM%convert hcPrJtJsGzHO75WZ.tif -fill White -draw "color 4829,6968 floodfill" +matte out.tiff
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: floodfill always ends up with transparent image

Post by fmw42 »

Works fine for me, too. I am on IM 6.8.9.6 Q16 Mac OSX
Post Reply