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

Re: Image looks different after removing transparent space and scaled

Post by niyanwen »

these two commands
convert img.png -resize 4500x5400! img_scale6.png
convert shirt.png -trim +repage -bordercolor none -border 5 shirt3.png
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 »

These two command do not involve the same input/output images. So please clarify the exact commands you used with proper file names to make the output you say is bad. Why are you resizing to the same size as the input -- 4500x4500 -- was the size of the input.
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 »

Those two commands take two inputs and make two outputs.

You have linked to only one input and one output.

So, which command made that output from that input?
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 »

so original image is like image a, c is output image

convert a.png -resize 4500x5400! b.png
convert b.png -trim +repage -bordercolor none -border 5 c.png
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 »

Why do you need two commands? You can make it just one and save writing an extra image to disk. Where is it failing? Look at the tmp files in my command.

Code: Select all

convert a.png -resize 4500x5400! +write tmp1.png -trim +repage +write tmp2.png -bordercolor none -border 5 result.png
If it works fine in IM 7, then just use IM 7. But when I ask a question, please answer it. Is your libpng the same in IM 7 as IM 6?

Why are you resizing to the same size as your input?
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 »

The thing is IM7 is slower than IM6 looks like 5x slower, we cannot afford it, I suspect it is becasue HDRI enabled?
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 »

oh sorry I found the second command I am using is this one
convert /var/folders/g0/tbbcb38x57j_lk7l__b7fgjxw39ddj/T/trim-image-src79649733683580374.png -format %@ -write info: -trim +repage -bordercolor none -border 5 /var/folders/g0/tbbcb38x57j_lk7l__b7fgjxw39ddj/T/trim-image-dest8416507457673086321.png

does this matter with the color things?
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 »

Please show the exact commands for both commands. Answer our questions properly.
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 »

so this is first command:
convert a.png -resize 4500x5400! b.png
this second command:
convert b.png -format %@ -write info: -trim +repage -bordercolor none -border 5 c.png

the input image I put is a.png and output is c.png, scaling size is dynamic and pass from input, it can be 4500x5400 later it can be 3500x5400

libpng version is same as I put in the other post, is there anything else you want to know?
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 »

If your libpng is the same on IM 6 and IM 7, then I do not know what else might cause it other than some issue with your IM 6 release.
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 »

last time you talked about lcme, looks IM6 doesn't have lcme and IM7 has, does that matter?
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 »

snibgo said it did not matter since you did not apply a profile to your result. But you could just try adding an sRGB profile to your input and result and see if that helps.
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 »

think it over I believe the bug happened in this command, sorry make you guys confused since our java application are using two commands together
convert b.png -format %@ -write info: -trim +repage -bordercolor none -border 5 c.png

the use case is I need to trim the transparency out of the image and get the offset, if there is any other command you guys can suggest? otherwise the only option for me is try using IM7
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 »

I do not understand. Your command works fine for me.

Code: Select all

convert b07s8dt2vc-large-front_image.png -resize 4500x5400! -format %@ -write info: -trim +repage -bordercolor none -border 5 result.png
3739x5194+452+57

It gives the offsets.
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 »

oh the offset is correct, the bug I mean is the output is different, as I mentioned earlier in this post, there is transparency in the original pic but in the output these transparency are missing, the transparaency I men is on the image, like black ranger in the pic with IM6
original: https://drive.google.com/open?id=1ufx2A ... XZMolPcnf1
output: https://drive.google.com/open?id=122q_p ... mGJcV0XuFz
Post Reply