Create inner frame with offset

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
The Guy from CGN
Posts: 8
Joined: 2019-07-14T21:26:17-07:00
Authentication code: 1152

Create inner frame with offset

Post by The Guy from CGN »

Good Morning,

I changed my RAW converter from Lightroom (LR) to Capture1 (C1). Within LR I have been used LR/Mogrify2 plugin [1] to place watermarks, text annotations, frames etc, but with C1 have to create my own scripts.
It was no big deal to create scripts which add watermarks and text annotations. But with the frames I have no glue how to solve. Here you can see what kind of frame I would like to create:
Image
It's not good visible on this image but the frame has an opacity of 60%.

The dimensions I have sketched here:
Image

I have tried frame, border, shave etc but not solution found. I can add a frame outside the image with or without changing the image dimensions. The frame should not have an absolut dimensions but relative to the image border because not all images will have the same resolution.

I expect that it is possible with Imagemagick because the a.m. plugin for LR works completely with Mogrify.

Do you have a hint or maybe a solution for my problem?

Thanks for your support!


[1] https://www.photographers-toolbox.com/p ... grify2.php
Mogrify
Version: ImageMagick 7.0.8-53 Q16 x64 2019-07-06
Win10 Pro x64
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Create inner frame with offset

Post by snibgo »

I'm not sure what you want, and your images are too small to help me.

There are many ways to do this. The following takes an input (toes.png) and makes a copy that is white but the outermost 15 pixels are 50% gray. This is used to change the opacity. The result is flattened against red, so the result is the toes image but with the outermost pixels shaded red. Then we add a pink border.

Code: Select all

magick ^
  toes.png ^
  ( +clone ^
    -fill White -colorize 100 ^
    -shave 15 ^
    -bordercolor gray(50%%) ^
    -gravity center ^
    -border 15 ^
  ) ^
  -alpha off ^
  -compose CopyOpacity -composite ^
  -background Red ^
  -compose Over -layers Flatten ^
  -bordercolor Pink ^
  -border 20 ^
  out_bord2.png
Image
Change the colours etc as you want.
snibgo's IM pages: im.snibgo.com
The Guy from CGN
Posts: 8
Joined: 2019-07-14T21:26:17-07:00
Authentication code: 1152

Re: Create inner frame with offset

Post by The Guy from CGN »

Thanks for your reply. This is an interesting solution.
1. Clone the image
2. Shave that by 30 px
3. Add a colorized border of 15 px

For the colour I could also use RGBA(R,G,B, opacity).

I will give it a try.
Mogrify
Version: ImageMagick 7.0.8-53 Q16 x64 2019-07-06
Win10 Pro x64
Post Reply