Removing backgound by applying clipping path

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
masterbp
Posts: 27
Joined: 2007-10-08T06:23:33-07:00

Removing backgound by applying clipping path

Post by masterbp »

Hi

I'm trying to remove the background of an image by using the photoshop clipping path embedded in the image, but ImageMagick seems to ignore the clippping path

Here is what i did:
  • Downloaded and installed ImageMagick-6.3.6-1-Q8-windows-static.exe
  • Downloaded sample file from http://www.dortheogbenny.dk/test.tif (11Mb)
  • Ran command

    Code: Select all

    "c:\Program Files\ImageMagick-6.3.6-Q8\convert.exe" test.tif -colorspace RGB +clip-path #1 -fill white -draw "color 0,0 reset" test.png
The program gave the following warnings:

Code: Select all

convert.exe: test.tif: unknown field with tag 34152 (0x8568) encountered. `TIFFR
eadDirectory'.
convert.exe: Non-conforming drawing primitive definition `color'.
Resulting image can be seen here: http://www.dortheogbenny.dk/test.png (14Mb)
The resulting image does not have any white background.

I have tried with all binary versions for windows from the Imagemagick Website - all with the same result. Could anyone give me a hint about what I do wrong?
masterbp
Posts: 27
Joined: 2007-10-08T06:23:33-07:00

Re: Removing backgound by applying clipping path

Post by masterbp »

I have now tried the above command, but this time with env. variable MAGICK_DEBUG set to 'all'. I now get a lot of debug information, but i still can't figure out why Imagemagick won't apply the clipping path.

The log file can be downloaded here: http://www.dortheogbenny.dk/output.zip (2Mb)

There is no apparent errors in the log, except for the mentioned 'convert.exe: Non-conforming drawing primitive definition `color'.' error.

Could anyone help me out?

Thanks!

Benny
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Removing backgound by applying clipping path

Post by magick »

Weird wild stuff. We download 6.3.6-3 Q8 static under Windows and converted your image without any complaints.
masterbp
Posts: 27
Joined: 2007-10-08T06:23:33-07:00

Re: Removing backgound by applying clipping path

Post by masterbp »

Hi

I came a little step further:
Using Process Monitor, I could see that ImageMagick was looking for Ghostscript using registry lookups. I installed ghostscript and now the error messages have disappered.

(Process Monitor Log can be downloaded here: http://www.dortheogbenny.dk/convert.exe.zip)

But the resulting image still has a background :(

I'm almost out of ideas except checking versions of each and every depending DLLs

Any ideas?

Regards,

Benny
masterbp
Posts: 27
Joined: 2007-10-08T06:23:33-07:00

Re: Removing backgound by applying clipping path

Post by masterbp »

Hi

I have done some more testing with clipping path and Imagemagick. This time i tried the following command:

Code: Select all

convert test.tif -clip -fill red -size 640x480 test.png


I got the following results:

Windows XP (SP2)
Tested on four different machines (all with different setup/ patch level) using Convert.exe version 6.3.6Q8 static. The resulting image looks very wierd and the clipping path is still ignored. Image can be seen here:
http://www.dortheogbenny.dk/test_windows.png

Linux (Ubuntu LiveCd v7.0.4)
Tested with convert version 6.2.4 Q16. Worked as expected. Image can be seen here:
http://www.dortheogbenny.dk/test_linux.png
masterbp
Posts: 27
Joined: 2007-10-08T06:23:33-07:00

Re: Removing backgound by applying clipping path

Post by masterbp »

Hi

Now I managed to find a Windows 2003 server which works perfectly. I have no idea what the difference is though :(
Post Reply