Tidbits - Rounded shadow corners

A plethora of command-line scripts that perform geometric transforms, blurs, sharpens, edging, noise removal, and color manipulations.
Post Reply
Don
Posts: 47
Joined: 2013-05-09T14:10:43-07:00
Authentication code: 6789

Tidbits - Rounded shadow corners

Post by Don » 2014-06-27T23:22:12-07:00

Hello Fred,

I went over to your tidbits page and checked out the 'Rounded Corners with Shadows'. I was able to successfully apply that to an image but when I tried to crop that same image after applying the rounded corners with shadows, I get an imagemagick warning:

convert: geometry does not contain image 'imageRndShad.png' @ warning/transform.c/CropImage/666.

This is the cropping command that gave the warning:

convert imageRndShad.png -resize 300x300 -gravity center -crop 175x175+0+0 +repage cropped.png

In case you need to know any more info:
- The dimensions for the image imageRndShad.png is: 1012 × 762
- Imagemagick version is: ImageMagick 6.8.7-9
- The rounded shadow corners command applied is the one on your tidbits page.

Greatly appreciate it. Thank you!

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

Re: Tidbits - Rounded shadow corners

Post by snibgo » 2014-06-28T05:33:16-07:00

I'm not Fred, but the image may have a canvas offset, so he might want to know the result of:

Code: Select all

identify imageRndShad.png
snibgo's IM pages: im.snibgo.com

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

Re: Tidbits - Rounded shadow corners

Post by fmw42 » 2014-06-28T10:05:05-07:00

It might be a bug in your version of IM. Try upgrading IM.

This works fine for me with no errors on IM 6.8.9.4 Q16 Mac OSX

Code: Select all

convert thumbnail.gif \( +clone -alpha extract \
\( -size 15x15 xc:black -draw 'fill white circle 15,15 15,0' -write mpr:arc +delete \) \
\( mpr:arc \) -gravity northwest -composite \
\( mpr:arc -flip \) -gravity southwest -composite \
\( mpr:arc -flop \) -gravity northeast -composite \
\( mpr:arc -rotate 180 \) -gravity southeast -composite \) \
-alpha off -compose CopyOpacity -composite -compose over \
\( +clone -background black -shadow 80x3+5+5 \) \
+swap -background none -layers merge thumbnail_rounded_shade2.png
Followed by

Code: Select all

convert thumbnail_rounded_shade2.png -resize 300x300 -gravity center -crop 175x175+0+0 +repage cropped.png
(no errors reported)


The output from the tidbits command does have a virtual-canvas,
Page geometry: 131x101-1-1
Origin geometry: -1-1

So try adding +repage to your input as or just before the output of my tidbits command

convert imageRndShad.png +repage -resize 300x300 -gravity center -crop 175x175+0+0 +repage cropped.png



But what is the point of resizing and cropping to remove all of the rounded border an shadow? You might as well just resized and cropped the original input image.

Don
Posts: 47
Joined: 2013-05-09T14:10:43-07:00
Authentication code: 6789

Re: Tidbits - Rounded shadow corners

Post by Don » 2014-06-29T11:35:43-07:00

Thanks for the responses.

This command worked: convert imageRndShad.png +repage -resize 300x300 -gravity center -crop 175x175+0+0 +repage cropped.png

I was attempting to make a thumbnail for that image.

Fred, quick IM upgrade question... on a linux system, to update imagemagick manually, would I have to remove the previous version or does imagemagick rewrite the previous files with the new upgraded files upon installation?

Thanks.

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

Re: Tidbits - Rounded shadow corners

Post by fmw42 » 2014-06-29T13:02:12-07:00

Fred, quick IM upgrade question... on a linux system, to update imagemagick manually, would I have to remove the previous version or does imagemagick rewrite the previous files with the new upgraded files upon installation?
I am on a Mac OSX (unix) and do not have to uninstall when installing a new version from source. Pretty sure it is the same with Linux.

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

Re: Tidbits - Rounded shadow corners

Post by fmw42 » 2014-06-29T13:05:03-07:00

Without the +repage, crop may be off a couple of pixels due to the virtual-canvas offset. So it would be best to add +repage at the end of my tidbits command

convert thumbnail.gif \( +clone -alpha extract \
\( -size 15x15 xc:black -draw 'fill white circle 15,15 15,0' -write mpr:arc +delete \) \
\( mpr:arc \) -gravity northwest -composite \
\( mpr:arc -flip \) -gravity southwest -composite \
\( mpr:arc -flop \) -gravity northeast -composite \
\( mpr:arc -rotate 180 \) -gravity southeast -composite \) \
-alpha off -compose CopyOpacity -composite -compose over \
\( +clone -background black -shadow 80x3+5+5 \) \
+swap -background none -layers merge +repage thumbnail_rounded_shade2.png

Don
Posts: 47
Joined: 2013-05-09T14:10:43-07:00
Authentication code: 6789

Re: Tidbits - Rounded shadow corners

Post by Don » 2014-06-29T16:03:48-07:00

fmw42 wrote:
I am on a Mac OSX (unix) and do not have to uninstall when installing a new version from source. Pretty sure it is the same with Linux.
Pretty sure it's the same as well. So basically when installing new version, previous version gets overwritten? Or it does not get over written and new version is installed/configured to be used for the system?

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

Re: Tidbits - Rounded shadow corners

Post by fmw42 » 2014-06-29T16:32:27-07:00

They are overwritten in your system as long as you do not install to different locations, which is not a good idea. There could be conflicts if you have multiple versions installed. The download folder (that is used for ./configure and make) can be deleted any time after doing a successful make install.

Don
Posts: 47
Joined: 2013-05-09T14:10:43-07:00
Authentication code: 6789

Re: Tidbits - Rounded shadow corners

Post by Don » 2014-06-29T22:23:50-07:00

Thank you! Realy appreciate it!

Though I'd ask as well: does this rule on being overwritten basically apply to other programs/software as well on linux/unix systems?

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

Re: Tidbits - Rounded shadow corners

Post by fmw42 » 2014-06-29T22:28:27-07:00

I have no idea. I suspect each may operate differently. But most the I have used seem to over write what was there. But I am not a Unix expert. So I cannot say for sure.

Post Reply