Image looks different after removing transparent space and scaled

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?".
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

Image looks different after removing transparent space and scaled

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Image looks different after removing transparent space and scaled

Post by fmw42 »

Post the input image alone. It is likely a profile issue.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Image looks different after removing transparent space and scaled

Post by snibgo »

What version of IM, on what platform?

I suggest you link to actual PNG files, not a screen shot.
snibgo's IM pages: im.snibgo.com
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

Re: Image looks different after removing transparent space and scaled

Post 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;
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Image looks different after removing transparent space and scaled

Post 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?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Image looks different after removing transparent space and scaled

Post 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.
snibgo's IM pages: im.snibgo.com
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

Re: Image looks different after removing transparent space and scaled

Post 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
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

Re: Image looks different after removing transparent space and scaled

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Image looks different after removing transparent space and scaled

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Image looks different after removing transparent space and scaled

Post 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.
snibgo's IM pages: im.snibgo.com
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

Re: Image looks different after removing transparent space and scaled

Post 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
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

Re: Image looks different after removing transparent space and scaled

Post 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?
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

Re: Image looks different after removing transparent space and scaled

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Image looks different after removing transparent space and scaled

Post 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.
Post Reply