xv -acrop vs. convert -trim

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
btnadiga

xv -acrop vs. convert -trim

Post by btnadiga »

This is the original image
Image

This is what I get with xv -acrop
Image

This is what I get with convert -trim (and with -fuzz ...)
Image

Question: How do I quickly achieve the same results as I get with xv -acrop using imagemagick?

I realize I can extend some of the sides with a color, then trim, then chop as on the trim example page, but wondering if there isn't a simple way to achieve this a la xv.

Thanks
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: xv -acrop vs. convert -trim

Post by fmw42 »

btnadiga wrote:This is the original image
Image

This is what I get with xv -acrop
Image

This is what I get with convert -trim (and with -fuzz ...)
Image

Question: How do I quickly achieve the same results as I get with xv -acrop using imagemagick?

I realize I can extend some of the sides with a color, then trim, then chop as on the trim example page, but wondering if there isn't a simple way to achieve this a la xv.

Thanks

See the other post. I don't believe there is an simple, one-step way. Also your example images do not show here.
btnadiga

Re: xv -acrop vs. convert -trim

Post by btnadiga »

>>> Also your example images do not show here

I was afraid that was the case.
This forum does not allow uploading images, so I clicked on the Img button and provided the urls. But the images do not show up. So, what do I do for the readers to be actually able to see the images.

Thanks, I'm a newbie
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: xv -acrop vs. convert -trim

Post by fmw42 »

btnadiga wrote:>>> Also your example images do not show here

I was afraid that was the case.
This forum does not allow uploading images, so I clicked on the Img button and provided the urls. But the images do not show up. So, what do I do for the readers to be actually able to see the images.

Thanks, I'm a newbie
You have to post the images on your own server and then provide an link to them (and you can surround that link with the Img tags from the button above to make the linked images appear in place).

Looks like one can click the icons and get the images to display, so you do have them linked properly. You may just not have used the Img button above correctly. Highlight your link, then just click the Img button above. Then your images should display here.

What was your convert ... -fuzz ... -trim ... command? Looks like you may not have done that right if the result is not trimmed.


What I would do with this picture, would be to measure the corner colors for use later as a border color, then trim to minimum size with -fuzz -trim, then add a border back either all around or on the sides you want using either -border or -extent.

Try this:

color=`convert 009.jpg -format "%[pixel:s.p{0,0}]" info:`
convert 009.jpg -fuzz 10% -trim -bordercolor $color -border 10 009_trim_f10_b10.jpg

Image
btnadiga

Re: xv -acrop vs. convert -trim

Post by btnadiga »

fmw42,

Perfect. I still have to figure out the syntax of your color reading command.

I was simply using -fuzz xx% and got nowhere. I was thinking of reading a color, but obviously there is no way I could have guessed at the syntax of that command.

About posting the image. I cannot figure out why my images do not show up. I do exactly what you mention. And I can see your image. Do I have to get permission from a moderator or so?

I would like to edit the original question so that the images show up.

Thanks
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: xv -acrop vs. convert -trim

Post by fmw42 »

btnadiga wrote:fmw42,

Perfect. I still have to figure out the syntax of your color reading command.

I was simply using -fuzz xx% and got nowhere. I was thinking of reading a color, but obviously there is no way I could have guessed at the syntax of that command.

About posting the image. I cannot figure out why my images do not show up. I do exactly what you mention. And I can see your image. Do I have to get permission from a moderator or so?

I would like to edit the original question so that the images show up.

Thanks
The command
color=`convert 009.jpg -format "%[pixel:s.p{0,0}]" info:`
has nothing to do with the trimming. It is only there to measure the color of the upper left corner so that I can use that same color for the added border after trimming.

See:
http://www.imagemagick.org/Usage/transform/#fx_escapes

Here are your images. Your problem is that you linked to the html page they are on and not just the jpg image.
Image

Image

Image

If you can fix your images, then I will remove these here. The way to do that is to go to the page you have linked and then click on the image and have the browser open the image in a new window. Then get that url. It should end in .jpg. Then use that url for linking to your images.
Post Reply