Page 1 of 4

Image looks different after removing transparent space and scaled

Posted: 2019-10-04T11:32:19-07:00
by niyanwen
Hi,

I have an original image, I scale it and remove the transparence

but I randomly found one image, the output image is slightly different from original image anyone knows why this happening?

the command I am using is to trim transparent space is
convert SHIRT_ART_IMAGE1.png -format "%@" +write info: -trim +repage -bordercolor none -border 5 SHIRT_ART_IMAGE1_trim.png

image compare url: https://ibb.co/WHrtTtW

Re: Image looks different after removing transparent space and scaled

Posted: 2019-10-04T11:49:28-07:00
by fmw42
Post the input image alone. It is likely a profile issue.

Re: Image looks different after removing transparent space and scaled

Posted: 2019-10-04T11:52:09-07:00
by snibgo
What version of IM, on what platform?

I suggest you link to actual PNG files, not a screen shot.

Re: Image looks different after removing transparent space and scaled

Posted: 2019-10-04T11:57:25-07:00
by niyanwen
yeah, but the image is 16MB, could you recommend a place I can upload image?
the version we use IM is ImageMagick = 6.9.4_1;

Re: Image looks different after removing transparent space and scaled

Posted: 2019-10-04T12:11:17-07:00
by niyanwen

Re: Image looks different after removing transparent space and scaled

Posted: 2019-10-04T12:30:14-07:00
by fmw42
This command works fine for me with no color change using ImageMagick 6.9.10.67 Q16 Mac OSX with libpng @1.6.36.

Code: Select all

convert shirt.png -trim +repage -bordercolor none -border 5 shirt3.png

My guess is that it has to do with the version of libpng you have installed or with the version of ImageMagick.

What are your versions and platform/OS?

Re: Image looks different after removing transparent space and scaled

Posted: 2019-10-04T15:53:03-07:00
by snibgo
I can see no difference between the linked images, except for the border. They have partial transparency, so when viewed against a dark/light chequerboard background, the dark/light squares occur at different places.

Re: Image looks different after removing transparent space and scaled

Posted: 2019-10-04T16:27:06-07:00
by niyanwen
@fmw42

when I run ./convert on my remote host I saw this info
Version: ImageMagick 6.9.4-1 Q16 x86_64 2019-09-29 http://www.imagemagick.org

for platform version, I run this command, and here is output uname -a
Linux mftp-ygw-p-f-2-1a-1ebf0e1c.us-east-1.amazon.com 4.9.184-0.1.ac.235.83.329.metal1.x86_64 #1 SMP Tue Jul 30 17:17:50 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Re: Image looks different after removing transparent space and scaled

Posted: 2019-10-04T16:28:15-07:00
by niyanwen
@snibgo

I saw there are some faded color on the original pic and there are not on processed image, could we take it as difference?

Re: Image looks different after removing transparent space and scaled

Posted: 2019-10-04T16:41:23-07:00
by fmw42
Your Imagemagick is ancient, though currently patched. But Linux distributions often only patch for security. So it is possible there is a bug. I saw no difference.

Try

convert -list format

and see what version you have for PNG.

Re: Image looks different after removing transparent space and scaled

Posted: 2019-10-04T17:01:33-07:00
by snibgo
niyanwen wrote: I saw there are some faded color on the original pic and there are not on processed image, could we take it as difference?
Where? If you have a chequerboard background, or any non-constant background, that will create a difference. But the difference is because of the way you are viewing.

Re: Image looks different after removing transparent space and scaled

Posted: 2019-10-04T19:40:29-07:00
by niyanwen
Hi,
I run the convert- list format, and below is what I got
PNG* rw- Portable Network Graphics (libpng 1.6.28)
See http://www.libpng.org/ for details about the PNG format.
PNG00* rw- PNG inheriting bit-depth, color-type from original if possible
PNG24* rw- opaque or binary transparent 24-bit RGB (zlib 1.2.11)
PNG32* rw- opaque or transparent 32-bit RGBA
PNG48* rw- opaque or binary transparent 48-bit RGB
PNG64* rw- opaque or transparent 64-bit RGBA
PNG8* rw- 8-bit indexed with optional binary transparency

Re: Image looks different after removing transparent space and scaled

Posted: 2019-10-04T19:47:17-07:00
by niyanwen
Hi, @snibog

I am new to image processing, could you recommend what's the right way to view it? like by which software?

Re: Image looks different after removing transparent space and scaled

Posted: 2019-10-04T20:19:23-07:00
by niyanwen
I used GMIP to take a look and looks like the original image has transparency in the middle and scaled image hasn't transparency, could we consider this as a difference?

Re: Image looks different after removing transparent space and scaled

Posted: 2019-10-04T20:29:06-07:00
by fmw42
What scaling? Your original post command line has no scaling! What was your exact command? Your PNG version libpng 1.6.28 is a bit old. You might consider upgrading.