Path distorted when creating transparent PNG

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?".
jd.wiese
Posts: 28
Joined: 2012-11-21T00:14:48-07:00
Authentication code: 6789

Path distorted when creating transparent PNG

Post by jd.wiese »

Hi!

I have a problem creating a PNG with transparency from a JPG containing a clipping path. The resulting PNG looks as if the path is somehow distorted, although the path looks correct in Photoshop.

This is one of the JPGs:
https://cloud.netgroup.de/public.php?se ... e14aaa789f

This is the command-line I used and which works on other images:
> convert 40993000_1.jpg -alpha transparent -clip -alpha opaque 40993000_1.png

The output is:
attribute not recognized: Y
attribute not recognized: Y
attribute not recognized: Y
attribute not recognized: Y
attribute not recognized: Y
attribute not recognized: Y
attribute not recognized: Y

And this is the resulting PNG:
https://cloud.netgroup.de/public.php?se ... 8941804a1d

The problem is the same under Windows, OS X and Linux and with different versions of ImageMagick (tried different 6.8.x versions).

I checked the SVG-Info as mentioned in an earlier post (viewtopic.php?f=1&t=22322#p93710):

> identify -format '%[8BIM:1999,2998:#1]' 40993000_1.jpg >40993000_1.svg
> convert 40993000_1.svg info:
40993000_1.svg SVG 4926x2453 4926x2453+0+0 16-bit sRGB 2.79KB 1.980u 0:02.069

> identify 40993000_1.jpg
40993000_1.jpg JPEG 4926x2453 4926x2453+0+0 8-bit sRGB 3.415MB 0.000u 0:00.000

So the sizes of the path and the image seem to match. A "convert -version" gives the following:

Version: ImageMagick 6.8.9-1 Q16 x86_64 2014-07-20 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules
Delegates: bzlib djvu fftw fontconfig freetype gslib jng jpeg lcms ltdl lzma png ps tiff webp x xml zlib

Anything else I can check? Any help on this would be appreciated.

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

Re: Path distorted when creating transparent PNG

Post by magick »

The conversion appears to work with ImageMagick-6.8.9-6, the Beta release. It might work with 6.8.9-5, the current release. 6.8.9-6 should be released sometime this week.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Path distorted when creating transparent PNG

Post by snibgo »

It makes a bad result in v6.8.9-0. There have been recent bug fixes in paths, and the result in the current release (6.8.9-5) is improved but not perfect: the "holes" behind the handles are wrong, and there is a fault outside the left-side handle (which might be a problem with the image pah, not a bug in IM).

I think the developers are still working on the "holes" issue.
snibgo's IM pages: im.snibgo.com
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Path distorted when creating transparent PNG

Post by Bonzo »

Just going off topic for a moment - I wanted a jpg with a clipping path for my Imagemagick examples site and was under the impression it could be done in Photoshop but I can not get it to work. I have read it may be a problem with my version of Photoshop -CS6. Please can you explain to me how you do it.
jd.wiese
Posts: 28
Joined: 2012-11-21T00:14:48-07:00
Authentication code: 6789

Re: Path distorted when creating transparent PNG

Post by jd.wiese »

snibgo wrote:It makes a bad result in v6.8.9-0. There have been recent bug fixes in paths, and the result in the current release (6.8.9-5) is improved but not perfect: the "holes" behind the handles are wrong, and there is a fault outside the left-side handle (which might be a problem with the image pah, not a bug in IM).

I think the developers are still working on the "holes" issue.
I tried with 6.8.9-5 under Windows and can confirm this. The result is much better, but not perfect yet :-)
jd.wiese
Posts: 28
Joined: 2012-11-21T00:14:48-07:00
Authentication code: 6789

Re: Path distorted when creating transparent PNG

Post by jd.wiese »

Bonzo wrote:Just going off topic for a moment - I wanted a jpg with a clipping path for my Imagemagick examples site and was under the impression it could be done in Photoshop but I can not get it to work. I have read it may be a problem with my version of Photoshop -CS6. Please can you explain to me how you do it.
I am using Photoshop CS2, but the procedure should be the same:

1. Select the path
2. Click on the little round arrow-button in the upper right corner of the path palette
3. Choose "Beschneidungspfad" (I have a german version, maybee its "Cropping/Clipping path" in english?)
4. Confirm the dialog

The pathname is now written in bold, indicating that it is a clipping path.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Path distorted when creating transparent PNG

Post by Bonzo »

Thanks for the instructions. I am not very proficient with Photosop but I believe I created jpg with a clip path but Imagemagick reports either "No clip path defined" for -clip-path and "image size differs" for -clip.
I seem to remember reading last year that 64bit version of CS6 will not create a clip path but the 32bit will - I only installed the 64bit version as I thought I would have no need for the 32bit one.

Anyway I will try your instructions if I can get a 32bit version or an older version and see what happens.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Path distorted when creating transparent PNG

Post by fmw42 »

It works fine for me without the stripes in IM 6.8.9.5 Q16 Mac OSX. Except that the holes in the handles are not transparent. This is likely due to the paths not being drawn in opposite directions.

There is another report about IM not recognizing non-alternating direction paths from PS. Check the Bugs and Developers forums.
jd.wiese
Posts: 28
Joined: 2012-11-21T00:14:48-07:00
Authentication code: 6789

Re: Path distorted when creating transparent PNG

Post by jd.wiese »

fmw42 wrote:It works fine for me without the stripes in IM 6.8.9.5 Q16 Mac OSX. Except that the holes in the handles are not transparent. This is likely due to the paths not being drawn in opposite directions.
Strange. I tried with the same version under Windows and there is the fault near the left handle.
fmw42 wrote:There is another report about IM not recognizing non-alternating direction paths from PS. Check the Bugs forum.
Thanks for the hint. I will have a look at it.

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

Re: Path distorted when creating transparent PNG

Post by fmw42 »

Strange. I tried with the same version under Windows and there is the fault near the left handle.
Yes, there was block of white outside the handle. Is that what you meant.

Perhaps it is with your libpng? What version are you using?


Here is my result:

http://www.fmwconcepts.com/misc_tests/c ... 3000_1.png
jd.wiese
Posts: 28
Joined: 2012-11-21T00:14:48-07:00
Authentication code: 6789

Re: Path distorted when creating transparent PNG

Post by jd.wiese »

fmw42 wrote:Yes, there was block of white outside the handle. Is that what you meant.
Yes, that is exactly what i meant :-)
jd.wiese
Posts: 28
Joined: 2012-11-21T00:14:48-07:00
Authentication code: 6789

Re: Path distorted when creating transparent PNG

Post by jd.wiese »

fmw42 wrote:Perhaps it is with your libpng? What version are you using?
How do I check that?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Path distorted when creating transparent PNG

Post by fmw42 »

convert -list format

look at the version on PNG


PNG* PNG rw- Portable Network Graphics (libpng 1.6.12)


Also see my results that I posted above.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Path distorted when creating transparent PNG

Post by fmw42 »

The report is here viewtopic.php?f=2&t=25882

Check your version of libjpeg also.
jd.wiese
Posts: 28
Joined: 2012-11-21T00:14:48-07:00
Authentication code: 6789

Re: Path distorted when creating transparent PNG

Post by jd.wiese »

> convert -list format

JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (80)
JPG* JPEG rw- Joint Photographic Experts Group JFIF format (80)
...
PNG* PNG rw- Portable Network Graphics (libpng 1.6.10)
Post Reply