Page 1 of 3

Path distorted when creating transparent PNG

Posted: 2014-07-20T08:08:34-07:00
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

Re: Path distorted when creating transparent PNG

Posted: 2014-07-20T09:19:39-07:00
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.

Re: Path distorted when creating transparent PNG

Posted: 2014-07-20T10:00:50-07:00
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.

Re: Path distorted when creating transparent PNG

Posted: 2014-07-20T10:13:15-07:00
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.

Re: Path distorted when creating transparent PNG

Posted: 2014-07-20T23:29:22-07:00
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 :-)

Re: Path distorted when creating transparent PNG

Posted: 2014-07-20T23:38:14-07:00
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.

Re: Path distorted when creating transparent PNG

Posted: 2014-07-21T08:56:02-07:00
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.

Re: Path distorted when creating transparent PNG

Posted: 2014-07-21T09:38:53-07:00
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.

Re: Path distorted when creating transparent PNG

Posted: 2014-07-21T10:00:51-07:00
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

Re: Path distorted when creating transparent PNG

Posted: 2014-07-21T10:03:28-07:00
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

Re: Path distorted when creating transparent PNG

Posted: 2014-07-21T10:05:56-07:00
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 :-)

Re: Path distorted when creating transparent PNG

Posted: 2014-07-21T10:07:15-07:00
by jd.wiese
fmw42 wrote:Perhaps it is with your libpng? What version are you using?
How do I check that?

Re: Path distorted when creating transparent PNG

Posted: 2014-07-21T10:09:41-07:00
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.

Re: Path distorted when creating transparent PNG

Posted: 2014-07-21T10:16:40-07:00
by fmw42
The report is here viewtopic.php?f=2&t=25882

Check your version of libjpeg also.

Re: Path distorted when creating transparent PNG

Posted: 2014-07-21T12:48:13-07:00
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)