Adding svg frame around image

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
pasaliczaharije
Posts: 3
Joined: 2011-08-23T13:29:26-07:00
Authentication code: 8675308

Adding svg frame around image

Post by pasaliczaharije »

Hi

I'm trying to compose two images - one is photo image, and other is svg vector frame which i need to add as frame.
Is there any smarter way other than converting svg to png which matches same dimension as photo image and then composing those two images together?

Best
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Adding svg frame around image

Post by anthony »

Compositing the SVG over the raster image would probably be the best way of doing it. However I would suggest...
  • you set -background None before reading in the SVG. to set transparency.
  • make sure your imagemagick has RSVG handling rather than the internal MSVG
    http://www.imagemagick.org/Usage/draw/#svg
  • Look at 'framing' techniques. You may like to add a shadow to the SVG overlay before composition.
    http://www.imagemagick.org/Usage/thumbn ... er_overlay
  • If you plan to do this a lot to many images that are the same size you may like to look at saving a prepared overlay and some form of looping method.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Adding svg frame around image

Post by fmw42 »

Anthony,

Correct me if I am wrong, but does not the SVG standard support the use of url pointing to an image. So could one not make an SVG frame with a place inside it specifying a url that can be changed to use any image probably of the same size as specified by the the frame element to the url? see http://www.w3.org/TR/SVG/struct.html#ImageElement

Fred
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Adding svg frame around image

Post by anthony »

I don't know SVG code that well. I have never actually needed to generate my own code, just make use of code of others and puzzle through small changes to existing code. For example convert a fill of an area to a outline stroke of an area. Note real heavy for SVG code understanding.

Most people I believe don't code in SVG directly either, but use a SVG editor.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
pasaliczaharije
Posts: 3
Joined: 2011-08-23T13:29:26-07:00
Authentication code: 8675308

Re: Adding svg frame around image

Post by pasaliczaharije »

Tx for responses. It sound as nice trick to include image in svg. Will try that but i need to learn a little bit more on svg.

thx again.
Post Reply