Difference in smoothness of clip border

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
kriks
Posts: 114
Joined: 2008-01-04T05:52:03-07:00

Difference in smoothness of clip border

Post by kriks »

Hi,

I'm using a command like this for applying a clip path named 'det' when converting an eps to png, to keep background transparent:

Code: Select all

convert -verbose -units PixelsPerInch -density 1890 2315.eps -profile icc/Photoshop5DefaultCMYK.icc -profile icc/sRGB_IEC61966-2-1_black_scaled.icc -alpha transparent -clip-path det -alpha opaque -resize 1000x1000 2315.png
This works very well on my dev computer (gentoo), but gives crispy edges on the client machine (ubuntu 12.04)

I tried with the same imagemagick version on both machines : 6.8.7-0 (I also tried with 6.8.6-8)

Both are compiled without rsvg, and give the same output for

Code: Select all

convert -list format | grep -i svg
:

Code: Select all

     MSVG  SVG       rw+   ImageMagick's own SVG internal renderer
      SVG  SVG       rw+   Scalable Vector Graphics (XML 2.9.1)
     SVGZ  SVG       rw+   Compressed Scalable Vector Graphics (XML 2.9.1)
except for the XML version which is 2.7.8 on the ubuntu box

I tried with -antialias, with no change.

What could lead to this difference?
I can provide files via private message only.

--------
Another strange point I noticed: if I make the same command on a server which locale is fr_FR.UTF-8, I get this error:

Code: Select all

convert: différences dans la taille de l'image `2315.eps' @ error/image.c/SetImageClipMask/2395.
which means : Image size differs

If I add LC_ALL=C at the beginning, the error disappears and it works correctly.
Maybe a issue with decimal separator?
kriks
Posts: 114
Joined: 2008-01-04T05:52:03-07:00

Re: Difference in smoothness of clip border

Post by kriks »

up?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Difference in smoothness of clip border

Post by snibgo »

What are "crispy edges"? Perhaps you mean there is no anti-aliasing.

You might try "+antialias" on both machines. Does that make different results?

I think conversion from EPS is done by ghostscript. Do your machines have the same version of gs?

You are resizing after the clip, which will change the nature of the edges. I doubt that "-profile" makes a difference. What is the simplest command that shows the problem?
snibgo's IM pages: im.snibgo.com
kriks
Posts: 114
Joined: 2008-01-04T05:52:03-07:00

Re: Difference in smoothness of clip border

Post by kriks »

This is what i see after the given command :Image

I tried -antialias and +antialias without success.
Ghostscript is the same version on both server : GPL Ghostscript 9.05 (2012-02-08)


Here are 2 close looks (with no -resize) on the good server :
Image
Image

Here are 2 close looks (with no -resize) on the bad server :
Image
Image


This is the simplest command :

Code: Select all

convert -verbose -units PixelsPerInch -density 1890 2315.eps -alpha transparent  -clip-path det -alpha opaque -resize '1000x1000' -strip 'PNG24:2315.png'
Also, without resize and without profile, it gives strange result:
Image

I'm quite lost at the moment.
Any help would be greatly appreciated.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Difference in smoothness of clip border

Post by snibgo »

Very strange. Can you provide 2315.eps?
snibgo's IM pages: im.snibgo.com
kriks
Posts: 114
Joined: 2008-01-04T05:52:03-07:00

Re: Difference in smoothness of clip border

Post by kriks »

File sent as PM.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Difference in smoothness of clip border

Post by snibgo »

I haven't received a PM. Can you put it somewhere public such as Dropbox and put the URL here?
snibgo's IM pages: im.snibgo.com
kriks
Posts: 114
Joined: 2008-01-04T05:52:03-07:00

Re: Difference in smoothness of clip border

Post by kriks »

You're right, the file was too big. I've uploaded it here : http://kriks.free.fr/IM/2315.7z
Thank you
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Difference in smoothness of clip border

Post by snibgo »

A quick check on v6.Windows 7, IM v6.8.7,

Code: Select all

convert -density 1890 2315.eps -alpha transparent -clip-path det -alpha opaque -resize 1000x1000 -strip e.png
... with or without resize and strip, the result looks the same as from your good server.

Sorry, I have no suggestions, beyond reinstalling IM and GS on your bad server.
snibgo's IM pages: im.snibgo.com
kriks
Posts: 114
Joined: 2008-01-04T05:52:03-07:00

Re: Difference in smoothness of clip border

Post by kriks »

Could you tell me the libXml version you have?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Difference in smoothness of clip border

Post by snibgo »

I have no idea. How would I find out? (I use Windows pre-build binaries.)
snibgo's IM pages: im.snibgo.com
kriks
Posts: 114
Joined: 2008-01-04T05:52:03-07:00

Re: Difference in smoothness of clip border

Post by kriks »

I installed a windows version, but the dll inside listed as libxml gives me no version number...

I will try again against a fresh ubuntu 12.04 server install.
kriks
Posts: 114
Joined: 2008-01-04T05:52:03-07:00

Re: Difference in smoothness of clip border

Post by kriks »

It works well on a fresh ubuntu 12.04 install.
So I tried again some variations, and with a PNG32: output format, it works well.

Can you try with PNG24: output prefix? To see if you can reproduce the problem?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Difference in smoothness of clip border

Post by snibgo »

Yes, PNG24: fouls it up, and I get much the same visual result as you. This gives a 1-bit alpha, rather than 8 bits, so it's a quantisation issue. If you really want to reduce alpha to 1 bit, you probably need to manipulate it first.
snibgo's IM pages: im.snibgo.com
kriks
Posts: 114
Joined: 2008-01-04T05:52:03-07:00

Re: Difference in smoothness of clip border

Post by kriks »

I didn't want to reduce alpha to 1 bit, for me PNG32 is the way to go, I just don't know why it felt back to PNG24 without giving the prefix, strange.

Thank you very much for helping!
Post Reply